Package edu.uci.ics.jung.graph

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


        Collection<String> existingLabels = (Collection<String>)e.getUserDatum(JUConstants.LABEL);
        g.removeEdge(e);

        // It is possible that there is already an edge between g.getSource Blue and newRed
        Iterator<DirectedSparseEdge> sourceOutIt = source.getOutEdges().iterator();
        Edge fromSourceToNewRed = null;
        while(sourceOutIt.hasNext() && fromSourceToNewRed == null)
        {
          DirectedSparseEdge out = sourceOutIt.next();if (out.getDest() == newRed) fromSourceToNewRed = out;
        }
        if (fromSourceToNewRed == null)
        {
          fromSourceToNewRed = new DirectedSparseEdge(source,newRed);
          fromSourceToNewRed.setUserDatum(JUConstants.LABEL, existingLabels, UserData.CLONE);// no need to clone this one since I'll delete the edge in a bit
          g.addEdge(fromSourceToNewRed);
        }
        else
          // there is already a transition from source to newRed, hence all we have to do is merge the new labels into it.
          ((Collection<String>)fromSourceToNewRed.getUserDatum(JUConstants.LABEL)).addAll( existingLabels );
         
      }

      // now the elements of mergedVertices are in terms of the copied graph.
      for(Vertex vert:(Set<Vertex>)g.getVertices())
View Full Code Here


      prefixes = getPaths(prefixEdges);
    }
    Set<List<Label>> suffixes = computeSuffixes(tempRed, temp);
    List<List<Label>> questions =new LinkedList<List<Label>>();
    questions.addAll(mergePrefixWithSuffixes(prefixes, suffixes));
    Edge loopEdge = findEdge(tempRed, tempRed);
    if(loopEdge!=null){
      Collection<Label> looplabels = (Collection<Label>)loopEdge.getUserDatum(JUConstants.LABEL);
      questions.addAll(mergePrefixWithSuffixes(prefixes, looplabels,suffixes));
    }
   
    DirectedSparseGraph questionPrefixes = augmentPTA(DeterministicDirectedSparseGraph.initialise(), questions, true);
    Iterator<Vertex> questionIt = getEndPoints(questionPrefixes).iterator();
View Full Code Here

          for(CmpVertex target:transition.getValue())
          {
            DeterministicVertex targetVertex = DeterministicDirectedSparseGraph.findVertexNamed(target,graphToUpdate);
            if (targetVertex == null)
              throw new IllegalArgumentException("target state in diff is not known, looking at "+target);
            Edge e=DeterministicDirectedSparseGraph.findEdge(fromVertex, targetVertex);
            if (e == null)
              throw new IllegalArgumentException("edge in diff was not found");
           
            Set<Label> labels = ((Set<Label>)e.getUserDatum(JUConstants.LABEL));
            labels.remove(transition.getKey());if (labels.isEmpty()) graphToUpdate.removeEdge(e);
          }
      }
    }
View Full Code Here

        Collection<Label> existingLabels = (Collection<Label>)e.getUserDatum(JUConstants.LABEL);
        g.removeEdge(e);

        // It is possible that there is already an edge between g.getSource Blue and newRed
        Iterator<DirectedSparseEdge> sourceOutIt = source.getOutEdges().iterator();
        Edge fromSourceToNewRed = null;
        while(sourceOutIt.hasNext() && fromSourceToNewRed == null)
        {
          DirectedSparseEdge out = sourceOutIt.next();if (out.getDest() == newRed) fromSourceToNewRed = out;
        }
        if (fromSourceToNewRed == null)
        {
          fromSourceToNewRed = new DirectedSparseEdge(source,newRed);
          fromSourceToNewRed.setUserDatum(JUConstants.LABEL, existingLabels, UserData.CLONE);// no need to clone this one since I'll delete the edge in a bit
          g.addEdge(fromSourceToNewRed);
        }
        else
          // there is already a transition from source to newRed, hence all we have to do is merge the new labels into it.
          ((Collection<Label>)fromSourceToNewRed.getUserDatum(JUConstants.LABEL)).addAll( existingLabels );
         
      }

      // now the elements of mergedVertices are in terms of the copied graph.
      for(Vertex vert:(Set<Vertex>)g.getVertices())
View Full Code Here

        Collection<Label> existingLabels = (Collection<Label>)e.getUserDatum(JUConstants.LABEL);
        g.removeEdge(e);

        // It is possible that there is already an edge between g.getSource Blue and newRed
        Iterator<DirectedSparseEdge> sourceOutIt = source.getOutEdges().iterator();
        Edge fromSourceToNewRed = null;
        while(sourceOutIt.hasNext() && fromSourceToNewRed == null)
        {
          DirectedSparseEdge out = sourceOutIt.next();if (out.getDest() == newRed) fromSourceToNewRed = out;
        }
        if (fromSourceToNewRed == null)
        {
          fromSourceToNewRed = new DirectedSparseEdge(source,newRed);
          fromSourceToNewRed.setUserDatum(JUConstants.LABEL, existingLabels, UserData.CLONE);// no need to clone this one since I'll delete the edge in a bit
          g.addEdge(fromSourceToNewRed);
        }
        else
          // there is already a transition from source to newRed, hence all we have to do is merge the new labels into it.
          ((Collection<Label>)fromSourceToNewRed.getUserDatum(JUConstants.LABEL)).addAll( existingLabels );
         
      }

      // now the elements of mergedVertices are in terms of the copied graph.
      for(Vertex vert:(Set<Vertex>)g.getVertices())
View Full Code Here

        Collection<String> existingLabels = (Collection<String>)e.getUserDatum(JUConstants.LABEL);
        g.removeEdge(e);

        // It is possible that there is already an edge between g.getSource Blue and newRed
        Iterator<DirectedSparseEdge> sourceOutIt = source.getOutEdges().iterator();
        Edge fromSourceToNewRed = null;
        while(sourceOutIt.hasNext() && fromSourceToNewRed == null)
        {
          DirectedSparseEdge out = sourceOutIt.next();if (out.getDest() == newRed) fromSourceToNewRed = out;
        }
        if (fromSourceToNewRed == null)
        {
          fromSourceToNewRed = new DirectedSparseEdge(source,newRed);
          fromSourceToNewRed.setUserDatum(JUConstants.LABEL, existingLabels, UserData.CLONE);// no need to clone this one since I'll delete the edge in a bit
          g.addEdge(fromSourceToNewRed);
        }
        else
          // there is already a transition from source to newRed, hence all we have to do is merge the new labels into it.
          ((Collection<String>)fromSourceToNewRed.getUserDatum(JUConstants.LABEL)).addAll( existingLabels );
         
      }

      // now the elements of mergedVertices are in terms of the copied graph.
      for(Vertex vert:(Set<Vertex>)g.getVertices())
View Full Code Here

   
    DirectedSparseGraph gr = DifferenceVisualiser.ChangesToGraph.computeVisualisationParameters(grAerlang, difference);
    Map<String,String> edgeToColours = new TreeMap<String,String>();
    for(Object edgeObj:gr.getEdges())
    {
      Edge edge = (Edge)edgeObj;
      if (edge.containsUserDatumKey(JUConstants.DIFF))
        edgeToColours.put(edge.toString(), edge.getUserDatum(JUConstants.DIFF).toString());
    }
    Assert.assertEquals("{P1000-[a]->P1000=java.awt.Color[r=255,g=0,b=0], P1000-[b]->P1002=java.awt.Color[r=255,g=0,b=0], P1000-[c]->N1000=java.awt.Color[r=255,g=0,b=0], P1001-[a]->P1000=java.awt.Color[r=0,g=255,b=0], P1001-[b]->P1003=java.awt.Color[r=0,g=255,b=0], P1001-[d]->P1001=java.awt.Color[r=0,g=255,b=0], P1002-[c, d]->P1002=java.awt.Color[r=255,g=0,b=0], P1003-[a, c]->P1001=java.awt.Color[r=0,g=255,b=0]}",
        edgeToColours.toString());
  }
View Full Code Here

  public static Collection<String> getAlphabetForEdges(Collection<Edge> edges){
    HashSet<String> alphabet = new HashSet<String>();
    Iterator<Edge> edgeIt = edges.iterator();
    while(edgeIt.hasNext()){
      Edge e = (edgeIt.next());
      alphabet.addAll((Collection<String>)e.getUserDatum(JUConstants.LABEL));
    }
    return alphabet;
  }
View Full Code Here

    Set<String>loopLabels = new HashSet<String>();
    boolean loopToR = r.getSuccessors().contains(r);
    boolean redAndBlueNeighbours = r.getNeighbors().contains(q);
    if(loopToR||redAndBlueNeighbours){ //there either exists a loop to r or will do if r and b merge
      if(loopToR){
        Edge e = findEdge(r, r);
        HashSet<String> labels = (HashSet<String>)e.getUserDatum(JUConstants.LABEL);
        loopLabels.addAll(labels);
      }
      if(redAndBlueNeighbours){
        Edge e = findEdge(r,q);
        HashSet<String> labels = (HashSet<String>)e.getUserDatum(JUConstants.LABEL);
        loopLabels.addAll(labels);
      }
    }
    wIt = w.iterator();
    while(wIt.hasNext()){
View Full Code Here

   */
  protected static HashSet<List<String>> getShortSuffixes(@SuppressWarnings("unused") DirectedSparseGraph g, Vertex v){
    HashSet<List<String>> returnStrings = new HashSet<List<String>>();
    Iterator<Edge> outEdgeIt = v.getOutEdges().iterator();
    while(outEdgeIt.hasNext()){
      Edge e = outEdgeIt.next();
      if(DeterministicDirectedSparseGraph.isAccept(e.getOpposite(v))){
        ArrayList<Edge> l = new ArrayList<Edge>();
        l.add(e);
        returnStrings.addAll(getPaths(l));
      }
    }
View Full Code Here

TOP

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

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.