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

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


    if(different(blueRed))
        return -1;

    Iterator<DirectedSparseEdge> edgesOut = blueRed.getQ().getOutEdges().iterator();
    while(edgesOut.hasNext()){
      DirectedSparseEdge e = edgesOut.next();
      if(this.doneEdges.contains(e))
        continue;
     
      doneEdges.add(e);
      HashSet<String> labels = (HashSet<String>)e.getUserDatum(JUConstants.LABEL);
      Iterator<String> labelIt = labels.iterator();
      while(labelIt.hasNext()){
        List<String> string = new ArrayList<String>();
        string.add(labelIt.next());
        Vertex qi = e.getDest();
        Vertex qj = getVertex(original,blueRed.getR(), string);
        OrigStatePair newPair = new OrigStatePair(qi, qj);
        if(qj!=null){
          int equivalent = computeScore(original, newPair);
          if(equivalent<0){
View Full Code Here


       
        if(existing == null){
          pta.addVertex(newVertex);
          Vertex previous;
          previous = getVertex(pta, string.subList(0, i-1));// for i==1, getVertex will return the initial vertex
          DirectedSparseEdge e = new DirectedSparseEdge(previous, newVertex);
          Set<String> labels = new HashSet<String>();
          labels.add(string.get(i-1));
          e.addUserDatum(JUConstants.LABEL, labels, UserData.CLONE);
          pta.addEdge(e);
        }
        else
          if (different(new OrigStatePair(existing,newVertex)))
          {
View Full Code Here

    if (current == null)
      return null;
   
    for(int i = 0;i<string.size();i++){
      String label = string.get(i);
      DirectedSparseEdge edge = getEdgeWithLabel(current.getOutEdges(), label);
      if(edge == null)
        return null;
      current = edge.getDest();
    }
    return current;
  }
View Full Code Here

  }

  public static DirectedSparseEdge getEdgeWithLabel(Set<DirectedSparseEdge> edges, String label){
    Iterator<DirectedSparseEdge> edgeIt = edges.iterator();
    while(edgeIt.hasNext()){
      DirectedSparseEdge e = edgeIt.next();
      Set<String> labels = (Set<String>)e.getUserDatum(JUConstants.LABEL);
      if(labels.contains(label))
        return e;
    }
    return null;
  }
View Full Code Here

  }

  public static Edge findEdge(Vertex from, Vertex to){
    Iterator<DirectedSparseEdge> edgesOut = from.getOutEdges().iterator();
    while(edgesOut.hasNext()){
      DirectedSparseEdge current = edgesOut.next();
      if(current.getDest().equals(to))
        return current;
    }
    return null;
  }
View Full Code Here

    Set<Vertex> blues = new HashSet<Vertex>();
    for(Vertex v: DeterministicDirectedSparseGraph.findVertices(JUConstants.COLOUR, JUConstants.RED, model))
    {
      Iterator<DirectedSparseEdge>neighbourIt = v.getOutEdges().iterator();
      while(neighbourIt.hasNext()){
        DirectedSparseEdge next = neighbourIt.next();
        Vertex neighbour = next.getDest();
        JUConstants neighbourColour = (JUConstants)neighbour.getUserDatum(JUConstants.COLOUR);
        if(neighbourColour!=null){
          if(neighbourColour == JUConstants.RED)
            continue;
        }
View Full Code Here

  }
 
  public static boolean hasAcceptedNeighbours(Vertex v){
    Iterator<DirectedSparseEdge> neighbourIt = v.getOutEdges().iterator();
    while (neighbourIt.hasNext()){
      DirectedSparseEdge e = neighbourIt.next();
      Vertex to = e.getDest();
      if(DeterministicDirectedSparseGraph.isAccept(to))
        return true;
    }
    return false;
  }
View Full Code Here

    Set<Vertex> blues = new HashSet<Vertex>();
    for(Vertex v: DeterministicDirectedSparseGraph.findVertices(JUConstants.COLOUR, JUConstants.RED, model))
    {
      Iterator<DirectedSparseEdge>neighbourIt = v.getOutEdges().iterator();
      while(neighbourIt.hasNext()){
        DirectedSparseEdge next = neighbourIt.next();
        Vertex neighbour = next.getDest();
        JUConstants neighbourColour = (JUConstants)neighbour.getUserDatum(JUConstants.COLOUR);
        if(neighbourColour!=null){
          if(neighbourColour == JUConstants.RED)
            continue;
        }
View Full Code Here

  }
 
  public static boolean hasAcceptedNeighbours(Vertex v){
    Iterator<DirectedSparseEdge> neighbourIt = v.getOutEdges().iterator();
    while (neighbourIt.hasNext()){
      DirectedSparseEdge e = neighbourIt.next();
      Vertex to = e.getDest();
      if(DeterministicDirectedSparseGraph.isAccept(to))
        return true;
    }
    return false;
  }
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

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.