MAGiC  V5.0
Mailleurs Automatiques de Géometries intégrés à la Cao
hypergraphlib_neato.cpp
Aller à la documentation de ce fichier.
1 //####//------------------------------------------------------------
2 //####//------------------------------------------------------------
3 //####// MAGiC
4 //####// Jean Christophe Cuilliere et Vincent FRANCOIS
5 //####// Departement de Genie Mecanique - UQTR
6 //####//------------------------------------------------------------
7 //####// MAGIC est un projet de recherche de l equipe ERICCA
8 //####// du departement de genie mecanique de l Universite du Quebec a Trois Rivieres
9 //####// http://www.uqtr.ca/ericca
10 //####// http://www.uqtr.ca/
11 //####//------------------------------------------------------------
12 //####//------------------------------------------------------------
13 //####//
14 //####// hypergraphlib_neato.cpp
15 //####//
16 //####//------------------------------------------------------------
17 //####//------------------------------------------------------------
18 //####// COPYRIGHT 2000-2024
19 //####// jeu 13 jun 2024 11:53:59 EDT
20 //####//------------------------------------------------------------
21 //####//------------------------------------------------------------
22 #include <iostream>
23 #include <sstream>
24 
25 #pragma hdrstop
26 
27 #include "hypergraphlib_platform.h"
28 
29 #include "hypergraphlib_neato.h"
30 #include "hypergraphlib_graph.h"
31 #include "hypergraphlib_node.h"
32 
33 
34 
35 std::string NeatoGraph(const HypergraphLib::Graph & __G)
36 {/*
37  std::cout << "graph 1 { ";
38  std::cout << "node [ color = red ]\n";
39  std::cout << std::endl;
40  for (HypergraphLib::Graph::MapArcsById::const_iterator it=__G.GetArcs().begin();
41  it != __G.GetArcs().end(); it++)
42  {
43  std::cout << "A_"<<it->first <<"[ shape=plaintext, style=filled, fillcolor=white , width=.3, height=.3 , color=black]"<<std::endl ;
44  for (HypergraphLib::Arc::MultimapNodesById::const_iterator it2=it->second->Nodes().begin();
45  it2!=it->second->Nodes().end();it2++)
46  {
47  std::cout<< "N_"<<it2->first << " -- " << "A_"<<it->first <<" [ len=1.2 ]"<<std::endl;
48  }
49  std::cout << std::endl;
50  }
51  std::cout << std::endl;
52  std::cout << "}";
53  std::cout << std::endl;
54 */
55 
56  std::ostringstream result;
57  result << "graph 2 { ";
58  result << std::endl;
59  result << "node [ color = red ]\n";
60  result << std::endl;
61  for (HypergraphLib::Graph::MapNodesById::const_iterator it=__G.GetNodes().begin();
62  it != __G.GetNodes().end(); it++)
63  {
64  for (HypergraphLib::Node::MultimapArcsById::const_iterator it2=it->second->IncidentArcs().begin();
65  it2!=it->second->IncidentArcs().end();it2++)
66  {
67  result <<"A_"<<it2->first << " [ shape=plaintext, style=filled, fillcolor=white , width=.3, height=.3 , color=black ]" << std::endl;
68  result<< "A_"<<it2->first << " -- " << "N_"<<it->first <<"[len=1.2]"<<std::endl;
69  }
70  result << std::endl;
71  }
72  result << std::endl;
73  result << "}";
74  result << std::endl;
75  result << std::endl;
76  return result.str();
77 }
78 
hypergraphlib_neato.h
HypergraphLib::Graph::GetNodes
const MapNodesById & GetNodes() const
Definition: hypergraphlib_graph.h:178
hypergraphlib_graph.h
HypergraphLib::Graph
Definition: hypergraphlib_graph.h:58
hypergraphlib_platform.h
NeatoGraph
std::string NeatoGraph(const HypergraphLib::Graph &__G)
Definition: hypergraphlib_neato.cpp:35
hypergraphlib_node.h