demo/topology_demo.cc
changeset 1955 daca31868d70
parent 1909 2d806130e700
child 1956 a055123339d5
equal deleted inserted replaced
2:c2ae857a7962 3:9510c22b214a
    57   ColorSet colorSet;
    57   ColorSet colorSet;
    58 
    58 
    59   Graph::NodeMap<int> compMap(graph);
    59   Graph::NodeMap<int> compMap(graph);
    60   connectedComponents(graph, compMap);
    60   connectedComponents(graph, compMap);
    61 
    61 
    62   graphToEps(graph, "connected_components.eps").u().
    62   graphToEps(graph, "connected_components.eps").undirected().
    63     coords(coords).scaleToA4().enableParallel().
    63     coords(coords).scaleToA4().enableParallel().
    64     parEdgeDist(20.0).edgeWidthScale(2.0).nodeScale(20.0).
    64     parEdgeDist(20.0).edgeWidthScale(2.0).nodeScale(20.0).
    65     nodeColors(composeMap(colorSet, compMap)).run();
    65     nodeColors(composeMap(colorSet, compMap)).run();
    66 
    66 
    67   std::cout << "Result: connected_components.eps" << std::endl;
    67   std::cout << "Result: connected_components.eps" << std::endl;
   113 
   113 
   114   Graph::UEdgeMap<int> compMap(graph);
   114   Graph::UEdgeMap<int> compMap(graph);
   115   Graph::NodeMap<bool> cutMap(graph);
   115   Graph::NodeMap<bool> cutMap(graph);
   116   biNodeConnectedComponents(graph, compMap);
   116   biNodeConnectedComponents(graph, compMap);
   117   biNodeConnectedCutNodes(graph, cutMap);
   117   biNodeConnectedCutNodes(graph, cutMap);
   118   graphToEps(graph, "bi_node_connected_components.eps").u().
   118 
       
   119   graphToEps(graph, "bi_node_connected_components.eps").undirected().
   119     coords(coords).scaleToA4().enableParallel().
   120     coords(coords).scaleToA4().enableParallel().
   120     parEdgeDist(20.0).edgeWidthScale(5.0).nodeScale(20.0).
   121     parEdgeDist(20.0).edgeWidthScale(5.0).nodeScale(20.0).
   121     edgeColors(composeMap(colorSet, compMap)).
   122     edgeColors(composeMap(colorSet, compMap)).
   122     nodeColors(composeMap(functorMap(&color), cutMap)).
   123     nodeColors(composeMap(functorMap(&color), cutMap)).
   123     run();
   124     run();
   143   Graph::NodeMap<int> compMap(graph);
   144   Graph::NodeMap<int> compMap(graph);
   144   Graph::UEdgeMap<bool> cutMap(graph);
   145   Graph::UEdgeMap<bool> cutMap(graph);
   145   biEdgeConnectedComponents(graph, compMap);
   146   biEdgeConnectedComponents(graph, compMap);
   146   biEdgeConnectedCutEdges(graph, cutMap);
   147   biEdgeConnectedCutEdges(graph, cutMap);
   147 
   148 
   148   graphToEps(graph, "bi_edge_connected_components.eps").u().
   149   graphToEps(graph, "bi_edge_connected_components.eps").undirected().
   149     coords(coords).scaleToA4().enableParallel().
   150     coords(coords).scaleToA4().enableParallel().
   150     parEdgeDist(20.0).edgeWidthScale(2.0).nodeScale(20.0).
   151     parEdgeDist(20.0).edgeWidthScale(2.0).nodeScale(20.0).
   151     nodeColors(composeMap(colorSet, compMap)).
   152     nodeColors(composeMap(colorSet, compMap)).
   152     edgeColors(composeMap(functorMap(&color), cutMap)).run();
   153     edgeColors(composeMap(functorMap(&color), cutMap)).run();
   153   
   154   
   170   ColorSet colorSet;
   171   ColorSet colorSet;
   171 
   172 
   172   Graph::NodeMap<bool> partMap(graph);
   173   Graph::NodeMap<bool> partMap(graph);
   173   bipartitePartitions(graph, partMap);
   174   bipartitePartitions(graph, partMap);
   174 
   175 
   175   graphToEps(graph, "bipartite_partitions.eps").u().
   176   graphToEps(graph, "bipartite_partitions.eps").undirected().
   176     coords(coords).scaleToA4().enableParallel().
   177     coords(coords).scaleToA4().enableParallel().
   177     parEdgeDist(20.0).edgeWidthScale(2.0).nodeScale(20.0).
   178     parEdgeDist(20.0).edgeWidthScale(2.0).nodeScale(20.0).
   178     nodeColors(composeMap(functorMap(&color), partMap)).run();
   179     nodeColors(composeMap(functorMap(&color), partMap)).run();
   179   
   180   
   180   std::cout << "Result: bipartite_partitions.eps" << std::endl;
   181   std::cout << "Result: bipartite_partitions.eps" << std::endl;