Package edu.uci.ics.jung.graph

Examples of edu.uci.ics.jung.graph.DirectedSparseGraph


        ) throws Exception
   {
      String VERTEX = "Vertex";
      String EDGE = "Edge";

      DirectedSparseGraph/*<DefaultRef, DefaultRef<Edge>>*/ newGraph = new DirectedSparseGraph<BoostRef, BoostRef<Edge, Object>>();

      HashMap<Vertex, BoostRef<Vertex,?>> vertexMapping = new HashMap<Vertex, BoostRef<Vertex,?>>();
      for (Vertex vertex : graph.getVertices())
      {
         BoostRef<Vertex,?> newVertex = new BoostRef<Vertex,Object>(vertex, VERTEX, true);
         vertexMapping.put(vertex, newVertex);
         newGraph.addVertex(newVertex);
      }

      for (Edge edge : graph.getEdges())
      {
         BoostRef<Edge,?> newVertex = new BoostRef<Edge,Object>(edge, EDGE, true);
        
           newGraph.addVertex(newVertex);
 
           newGraph.addEdge(new BoostRef<Edge, Object>(edge, EDGE, true), // use a new object with reference to the original edge
                 vertexMapping.get(graph.getSource(edge)), newVertex);
 
           newGraph.addEdge(new BoostRef<Edge, Object>(edge, EDGE, true), // use a new object with reference to the original edge
                 newVertex, vertexMapping.get(graph.getDest(edge)));

      }

      Map<String, BoostFunction<? extends Object, Dimension,?>> typeDimensionGetter = new HashMap<String, BoostFunction<? extends Object, Dimension, ?>>();
View Full Code Here


public class ModelAnalysisBoostUtils {

 
  public  static Graph createStateGraph(Object model) throws Exception
  {
    DirectedSparseGraph result = new DirectedSparseGraph();

     if ( model instanceof ChainedTransformer)
     {
       Transformer[] transformers = ((ChainedTransformer) model).getTransformers();
       Transformer lastTransformer = null;
       int counter = 0;
       for ( Transformer transformer: transformers)
       {
         result.addVertex(transformer);
         if ( lastTransformer != null)
           result.addEdge( "" + counter++, lastTransformer, transformer);
         lastTransformer = transformer;
       }
      
       return result;
     }
View Full Code Here

TOP

Related Classes of edu.uci.ics.jung.graph.DirectedSparseGraph

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.