1 |
francois |
283 |
#include "gestionversion.h" |
2 |
|
|
#include <iostream> |
3 |
|
|
#include <sstream> |
4 |
|
|
|
5 |
|
|
#pragma hdrstop |
6 |
|
|
|
7 |
|
|
#include "HypergraphLib_platform.h" |
8 |
|
|
|
9 |
|
|
#include "HypergraphLib_Neato.h" |
10 |
|
|
#include "HypergraphLib_Graph.h" |
11 |
|
|
#include "HypergraphLib_Arc.h" |
12 |
|
|
#include "HypergraphLib_Node.h" |
13 |
|
|
|
14 |
|
|
|
15 |
|
|
|
16 |
|
|
std::string NeatoGraph(const HypergraphLib::Graph & __G) |
17 |
|
|
{/* |
18 |
|
|
std::cout << "graph 1 { "; |
19 |
|
|
std::cout << "node [ color = red ]\n"; |
20 |
|
|
std::cout << std::endl; |
21 |
|
|
for (HypergraphLib::Graph::MapArcsById::const_iterator it=__G.GetArcs().begin(); |
22 |
|
|
it != __G.GetArcs().end(); it++) |
23 |
|
|
{ |
24 |
|
|
std::cout << "A_"<<it->first <<"[ shape=plaintext, style=filled, fillcolor=white , width=.3, height=.3 , color=black]"<<std::endl ; |
25 |
|
|
for (HypergraphLib::Arc::MultimapNodesById::const_iterator it2=it->second->Nodes().begin(); |
26 |
|
|
it2!=it->second->Nodes().end();it2++) |
27 |
|
|
{ |
28 |
|
|
std::cout<< "N_"<<it2->first << " -- " << "A_"<<it->first <<" [ len=1.2 ]"<<std::endl; |
29 |
|
|
} |
30 |
|
|
std::cout << std::endl; |
31 |
|
|
} |
32 |
|
|
std::cout << std::endl; |
33 |
|
|
std::cout << "}"; |
34 |
|
|
std::cout << std::endl; |
35 |
|
|
*/ |
36 |
|
|
|
37 |
|
|
std::ostringstream result; |
38 |
|
|
result << "graph 2 { "; |
39 |
|
|
result << std::endl; |
40 |
|
|
result << "node [ color = red ]\n"; |
41 |
|
|
result << std::endl; |
42 |
|
|
for (HypergraphLib::Graph::MapNodesById::const_iterator it=__G.GetNodes().begin(); |
43 |
|
|
it != __G.GetNodes().end(); it++) |
44 |
|
|
{ |
45 |
|
|
for (HypergraphLib::Node::MultimapArcsById::const_iterator it2=it->second->IncidentArcs().begin(); |
46 |
|
|
it2!=it->second->IncidentArcs().end();it2++) |
47 |
|
|
{ |
48 |
|
|
result <<"A_"<<it2->first << " [ shape=plaintext, style=filled, fillcolor=white , width=.3, height=.3 , color=black ]" << std::endl; |
49 |
|
|
result<< "A_"<<it2->first << " -- " << "N_"<<it->first <<"[len=1.2]"<<std::endl; |
50 |
|
|
} |
51 |
|
|
result << std::endl; |
52 |
|
|
} |
53 |
|
|
result << std::endl; |
54 |
|
|
result << "}"; |
55 |
|
|
result << std::endl; |
56 |
|
|
result << std::endl; |
57 |
|
|
return result.str(); |
58 |
|
|
} |
59 |
|
|
|