Package edu.uci.ics.jung.graph.impl

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


    String serviceShortPID = serviceCompletePID.substring(startIndexForConverterName);
   
    /*
     * Build the actual edge & attach it to the graph.
     * */
    Edge edge = new DirectedSparseEdge(sourceNode, targetNode);
   
    edge.addUserDatum("converter_name", serviceShortPID,
        new UserDataContainer.CopyAction.Shared());
    edge.addUserDatum("service_pid", serviceCompletePID,
        new UserDataContainer.CopyAction.Shared());
   
    outputGraph.addEdge(edge);
  }
View Full Code Here


          sourceDataType,  targetDataType, serviceReference);

      Edge directedEdge = sourceVertex.findEdge(targetVertex);
      if (directedEdge == null) {
        directedEdge =
            new DirectedSparseEdge(sourceVertex, targetVertex);
        graph.addEdge(directedEdge);
      }

      AbstractList serviceList =
          (AbstractList) directedEdge.getUserDatum(SERVICE_LIST);
View Full Code Here

   
    private Edge addEdge(Vertex parent, Vertex child, NexsmEdgeType et) throws GraphException {
        Edge e = null;
        try {
            if (_graphType == GraphTypes.Directed) {
                e = _myGraph.addEdge(new DirectedSparseEdge(parent, child));
            } else if (_graphType == GraphTypes.UnDirected)  {
                e = _myGraph.addEdge(new UndirectedSparseEdge(parent, child));
            }
            if (e != null)
                e.setUserDatum("edgetype", et, UserData.REMOVE);
View Full Code Here

    {
      Vertex v = vertexIt.next();
      outLabels.clear();
      Iterator<DirectedSparseEdge>outEdgeIt = v.getOutEdges().iterator();
      while(outEdgeIt.hasNext()){
        DirectedSparseEdge outEdge = outEdgeIt.next();
        outLabels.addAll( (Set<String>)outEdge.getUserDatum(JUConstants.LABEL) );
      }
      transitionsToBeAdded = !alphabet.equals(outLabels);
    }
   
    if (transitionsToBeAdded)
    {
      // third pass - adding transitions
      g.addVertex(rejectVertex);
      vertexIt = (Iterator<Vertex>)g.getVertices().iterator();
      while(vertexIt.hasNext())
      {
        Vertex v = vertexIt.next();
        if (v != rejectVertex)
        {// no transitions should start from the reject vertex
          Set<String> outgoingLabels = new TreeSet<String>();outgoingLabels.addAll(alphabet);
         
          Iterator<DirectedSparseEdge>outEdgeIt = v.getOutEdges().iterator();
          while(outEdgeIt.hasNext()){
            DirectedSparseEdge outEdge = outEdgeIt.next();
            outgoingLabels.removeAll( (Set<String>)outEdge.getUserDatum(JUConstants.LABEL) );
          }
          if (!outgoingLabels.isEmpty())
          {
            // add a transition
            DirectedSparseEdge edge = new DirectedSparseEdge(v,rejectVertex);
            edge.addUserDatum(JUConstants.LABEL, outgoingLabels, UserData.CLONE);
            g.addEdge(edge);
          }
        }
      }
    }
View Full Code Here

    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

    {
      Vertex v = vertexIt.next();
      outLabels.clear();
      Iterator<DirectedSparseEdge>outEdgeIt = v.getOutEdges().iterator();
      while(outEdgeIt.hasNext()){
        DirectedSparseEdge outEdge = outEdgeIt.next();
        outLabels.addAll( (Set<String>)outEdge.getUserDatum(JUConstants.LABEL) );
      }
      transitionsToBeAdded = !alphabet.equals(outLabels);
    }
   
    if (transitionsToBeAdded)
    {
      // third pass - adding transitions
      g.addVertex(rejectVertex);
      vertexIt = (Iterator<Vertex>)g.getVertices().iterator();
      while(vertexIt.hasNext())
      {
        Vertex v = vertexIt.next();
        if (v != rejectVertex)
        {// no transitions should start from the reject vertex
          Set<String> outgoingLabels = new TreeSet<String>();outgoingLabels.addAll(alphabet);
         
          Iterator<DirectedSparseEdge>outEdgeIt = v.getOutEdges().iterator();
          while(outEdgeIt.hasNext()){
            DirectedSparseEdge outEdge = outEdgeIt.next();
            outgoingLabels.removeAll( (Set<String>)outEdge.getUserDatum(JUConstants.LABEL) );
          }
          if (!outgoingLabels.isEmpty())
          {
            // add a transition
            DirectedSparseEdge edge = new DirectedSparseEdge(v,rejectVertex);
            edge.addUserDatum(JUConstants.LABEL, outgoingLabels, UserData.CLONE);
            g.addEdge(edge);
          }
        }
      }
    }
View Full Code Here

    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

  public static Set<List<String>> computeSuffixes(Vertex v, DirectedSparseGraph model){
    Set<List<String>> returnSet = new HashSet<List<String>>();
    DijkstraShortestPath p = new DijkstraShortestPath(model);
    Iterator<DirectedSparseEdge> edgeIt = model.getEdges().iterator();
    while(edgeIt.hasNext()){
      DirectedSparseEdge e = edgeIt.next();
      List<Edge> sp = null;
      sp = p.getPath(v, e.getSource());
      if(sp!=null){
        if(!sp.isEmpty()){
          sp.add(e);
          Set<List<String>> paths = getPaths(sp);
          returnSet.addAll(paths);
        }
        else if(e.getSource().equals(v)) { //&&(e.getDest().equals(v))){ // KIRR: BUG FIXED
          sp.add(e);
          Set<List<String>> paths = getPaths(sp);
          returnSet.addAll(paths);
        }
      }
View Full Code Here

    Vertex q = pair.getQ();
    Vertex qDash = pair.getR();
    Iterator<DirectedSparseEdge> inEdges = q.getInEdges().iterator();
    Set<DirectedSparseEdge> removeEdges = new HashSet<DirectedSparseEdge>();
    while(inEdges.hasNext()){
      DirectedSparseEdge e = inEdges.next();
      DirectedSparseEdge eDash = new DirectedSparseEdge(e.getSource(), qDash);
      eDash.addUserDatum(JUConstants.LABEL, e.getUserDatum(JUConstants.LABEL), UserData.CLONE);
      if(!e.getSource().getSuccessors().contains(qDash))
        model.addEdge(eDash);
      else{
        Edge existing = findEdge(e.getSource(), qDash);
        Set<String> labels = (Set<String>)existing.getUserDatum(JUConstants.LABEL);// KIRR: if you use UserData.SHARED, you do not need to copy the result back using put
        labels.addAll((Set<String>)e.getUserDatum(JUConstants.LABEL));
        existing.setUserDatum(JUConstants.LABEL, labels, UserData.CLONE);
      }
      removeEdges.add(e);
    }
    Iterator<DirectedSparseEdge> outEdges = q.getOutEdges().iterator();
    while(outEdges.hasNext()){
      DirectedSparseEdge e = outEdges.next();
      DirectedSparseEdge eDash = new DirectedSparseEdge(qDash, e.getDest());
      eDash.addUserDatum(JUConstants.LABEL, e.getUserDatum(JUConstants.LABEL), UserData.CLONE);
      if(!qDash.getSuccessors().contains(e.getDest()))
        model.addEdge(eDash);
      else{
        Edge existing = findEdge(qDash, e.getDest());
        Set<String> labels = (Set<String>)existing.getUserDatum(JUConstants.LABEL);
View Full Code Here

      Vertex v = queueIt.next();
      Set<DirectedSparseEdge> edges = v.getOutEdges();
      Iterator<DirectedSparseEdge> edgeIt = edges.iterator();
      Map<String,DirectedSparseEdge> doneLabels = new HashMap<String,DirectedSparseEdge>();
      while(edgeIt.hasNext()){
        DirectedSparseEdge e = edgeIt.next();
        Set<String> labels = (Set<String>)e.getUserDatum(JUConstants.LABEL);
        Iterator<String> labelIt = labels.iterator();
        while(labelIt.hasNext()){
          String label = labelIt.next();
          if(doneLabels.get(label)==null)
            doneLabels.put(label, e);
          else {
            DirectedSparseEdge eDash = doneLabels.get(label);
            OrigStatePair p = null;
            if(DeterministicDirectedSparseGraph.isInitial(eDash.getDest()))
              p = new OrigStatePair(e.getDest(), eDash.getDest());
            else
              p = new OrigStatePair(eDash.getDest(),e.getDest());
            if(!different(p)) // KIRR: strange - the two should never be different if the original pair to choose was selected properly
              return p;
          }
        }
      }
View Full Code Here

TOP

Related Classes of edu.uci.ics.jung.graph.impl.DirectedSparseEdge

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.