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