Examples of DirectedSparseGraph


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

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

      LogService logger) {
   
    this.nodeCount = 0;
    this.logger = logger;
    this.allConverterServices = allConverterServices;
    this.outputGraph = new DirectedSparseGraph();
   
    /*
     * Side affects nodes & edges
     * */
    processServiceReferences();
 
View Full Code Here

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

   */
  public DataConversionServiceImpl(BundleContext bContext, CIShellContext ciContext) {
    this.bContext = bContext;
    this.ciContext = ciContext;

    this.graph = new DirectedSparseGraph();
    this.dataTypeToVertex = new HashMap<String,Vertex>();

    String filter = "(&("+ALGORITHM_TYPE+"="+TYPE_CONVERTER+")" +
        "("+IN_DATA+"=*) " +
        "("+OUT_DATA+"=*)" +
View Full Code Here

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

       
        _graphType = type;
       
        _rndDecorator = new RandomVertexLocationDecorator(new Dimension(1000,1000));
        if (_graphType == GraphTypes.Directed) {
            _myGraph = new DirectedSparseGraph();
        } else if (_graphType == GraphTypes.UnDirected){
            _myGraph = new UndirectedSparseGraph();
        } else {
            throw new GraphException("Error in GraphManager, the specified graph type is not either Directed or UnDirected");
        }
View Full Code Here

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

    return v.containsUserDatumKey(JUConstants.INITIAL);   
  }

  /** Creates a graph with a single accept-vertex. */
  public static DirectedSparseGraph initialise(){
    DirectedSparseGraph pta = new DirectedSparseGraph();
    DirectedSparseVertex init = new DirectedSparseVertex();
    init.addUserDatum(JUConstants.INITIAL, true, UserData.SHARED);
    init.addUserDatum(JUConstants.ACCEPTED, true, UserData.SHARED);
    pta.setUserDatum(JUConstants.TITLE, "Hypothesis machine", UserData.SHARED);
    pta.addVertex(init);
    DeterministicDirectedSparseGraph.numberVertices(pta);
    return pta;
  }
View Full Code Here

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

   * This one only copies vertices which participate in transitions.
   */
  @SuppressWarnings("unchecked")
  public static DirectedSparseGraph copy(Graph g)
  {
    DirectedSparseGraph result = new DirectedSparseGraph();
    Map<VertexID,DeterministicVertex> newVertices = new TreeMap<VertexID,DeterministicVertex>();
    for(DirectedSparseEdge e:(Set<DirectedSparseEdge>)g.getEdges())
    {
      DeterministicVertex newSrc = DeterministicDirectedSparseGraph.copyVertex(newVertices,result,e.getSource()),
        newDst = DeterministicDirectedSparseGraph.copyVertex(newVertices, result, e.getDest());
      DirectedSparseEdge newEdge = new DirectedSparseEdge(newSrc,newDst);
      newEdge.addUserDatum(JUConstants.LABEL, ((HashSet<String>)e.getUserDatum(JUConstants.LABEL)).clone(), UserData.SHARED);
      result.addEdge(newEdge);
    }
    return result;
  }
View Full Code Here

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

    return v.containsUserDatumKey(JUConstants.INITIAL);   
  }

  /** Creates a graph with a single accept-vertex. */
  public static DirectedSparseGraph initialise(){
    DirectedSparseGraph pta = new DirectedSparseGraph();
    DirectedSparseVertex init = new DirectedSparseVertex();
    init.addUserDatum(JUConstants.INITIAL, true, UserData.SHARED);
    init.addUserDatum(JUConstants.ACCEPTED, true, UserData.SHARED);
    pta.setUserDatum(JUConstants.TITLE, "Hypothesis machine", UserData.SHARED);
    pta.addVertex(init);
    DeterministicDirectedSparseGraph.numberVertices(pta);
    return pta;
  }
View Full Code Here

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

   * This one only copies vertices which participate in transitions.
   */
  @SuppressWarnings("unchecked")
  public static DirectedSparseGraph copy(Graph g)
  {
    DirectedSparseGraph result = new DirectedSparseGraph();
    Map<VertexID,DeterministicVertex> newVertices = new TreeMap<VertexID,DeterministicVertex>();
    for(DirectedSparseEdge e:(Set<DirectedSparseEdge>)g.getEdges())
    {
      DeterministicVertex newSrc = DeterministicDirectedSparseGraph.copyVertex(newVertices,result,e.getSource()),
        newDst = DeterministicDirectedSparseGraph.copyVertex(newVertices, result, e.getDest());
      DirectedSparseEdge newEdge = new DirectedSparseEdge(newSrc,newDst);
      newEdge.addUserDatum(JUConstants.LABEL, ((HashSet<String>)e.getUserDatum(JUConstants.LABEL)).clone(), UserData.SHARED);
      result.addEdge(newEdge);
    }
    return result;
  }
View Full Code Here

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

  /**
   * @param hypothesis followed by actual graph
   */
  public static void main(String[] args) {
    DirectedSparseGraph specGraph = FsmParser.buildGraph("q0-initialise->q1-connect->q2-login->q3-setfiletype->q4-rename->q6-storefile->q5-setfiletype->q4-storefile->q7-appendfile->q5-setfiletype->q4\nq3-makedir->q8-makedir->q8-logout->q16-disconnect->q17\nq3-changedir->q9-listnames->q10-delete->q10-changedir->q9\nq10-appendfile->q11-logout->q16\nq3-storefile->q11\nq3-listfiles->q13-retrievefile->q13-logout->q16\nq13-changedir->q14-listfiles->q13\nq7-logout->q16\nq6-logout->q16", "specgraph");
    DirectedSparseGraph impGraph = FsmParser.buildGraph("q0-initialise->q1-connect->q2-login->q3-storefile->q9-logout->q12-disconnect->q13\nq3-makedir->q8-makedir->q8-logout->q12\nq3-setfiletype->q4-storefile->q5-appendfile->q6-setfiletype->q4-rename->q7-storefile->q6\nq7-logout->q12\nq3-listfiles->q11-retrievefile->q11-changedirectory->q10-listfiles->q11-logout->q12\nq3-changedirectory->q17-listnames->q16-changedirectory->q17\nq16-delete->q14-delete->q15-delete->q16\nq14-changedirectory->q13\nq14-appendfile->q7", "impGraph");
    compare(specGraph, impGraph);
  }
View Full Code Here

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

    DirectedSparseGraph impGraph = FsmParser.buildGraph("q0-initialise->q1-connect->q2-login->q3-storefile->q9-logout->q12-disconnect->q13\nq3-makedir->q8-makedir->q8-logout->q12\nq3-setfiletype->q4-storefile->q5-appendfile->q6-setfiletype->q4-rename->q7-storefile->q6\nq7-logout->q12\nq3-listfiles->q11-retrievefile->q11-changedirectory->q10-listfiles->q11-logout->q12\nq3-changedirectory->q17-listnames->q16-changedirectory->q17\nq16-delete->q14-delete->q15-delete->q16\nq14-changedirectory->q13\nq14-appendfile->q7", "impGraph");
    compare(specGraph, impGraph);
  }
 
  public static void compare(String spec, DirectedSparseGraph imp){
    DirectedSparseGraph specGraph = FsmParser.buildGraph(spec, "specGraph");
    compare(specGraph, imp);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.