1 |
francois |
1156 |
//####//------------------------------------------------------------ |
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 |
francois |
283 |
#include <iostream> |
23 |
|
|
#include <sstream> |
24 |
|
|
|
25 |
|
|
#pragma hdrstop |
26 |
|
|
|
27 |
francois |
481 |
#include "hypergraphlib_platform.h" |
28 |
francois |
283 |
|
29 |
francois |
481 |
#include "hypergraphlib_neato.h" |
30 |
|
|
#include "hypergraphlib_graph.h" |
31 |
|
|
#include "hypergraphlib_node.h" |
32 |
francois |
283 |
|
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 |
|
|
|