ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/REPOS_ERICCA/magic/outil/src/hypergraphlib_neato.cpp
Revision: 1019
Committed: Tue Jun 4 21:16:50 2019 UTC (6 years ago) by francois
File size: 1850 byte(s)
Log Message:
restructuration de magic
outil est sorti de lib pour pouvoir etre utiliser en dehors de lib
template est merge avec outil
poly_occ et un sous projet de magic qui utilise le nouveau outil

File Contents

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