Package net.wigis.graph.dnv

Examples of net.wigis.graph.dnv.DNVEdge


   * @param previousNode
   * @param node
   */
  private static void addEdge( DNVGraph graph, String type, DNVNode previousNode, DNVNode node )
  {
    DNVEdge edge = new DNVEdge( previousNode, node, graph );
    edge.setThickness( 4 );
    edge.setType( type );
    graph.addEdge( 0, edge );
  }
View Full Code Here


        else if( n.getNodeName().equals( "to" ) )
        {
          toid = clean( n.getTextContent() );
          Logger.write( "Fromid is: " + fromid );
          Logger.write( "toid is: " + toid );
          DNVEdge dnvedge = new DNVEdge( 0, 1.0f, false, ( nodeIdMap.get( fromid ) ), nodeIdMap.get( toid ), g );
          dnvedge.setId( edgeID );
          edgeID++;
          g.addNode( 0, dnvedge );
        }

      }
View Full Code Here

        }
        else if( currentChunkType.equals( "@EDGES" ) )
        {
          fromId = Integer.parseInt( currentLineArray.get( 0 ) );
          toId = Integer.parseInt( currentLineArray.get( 1 ) );
          DNVEdge dnvEdge = new DNVEdge( dnvGraph );
          dnvEdge.setLevel( 0 );
          dnvEdge.setId( currentOffset + j );
          fromNode = (DNVNode)dnvGraph.getNodeById( fromId );
          toNode = (DNVNode)dnvGraph.getNodeById( toId );
          dnvEdge.setFrom( fromNode );
          dnvEdge.setTo( toNode );
          dnvGraph.addNode( 0, dnvEdge );
        }
      }
    }
View Full Code Here

        for(int i = minIndex; i <= maxIndex; i++){
          DNVNode node = new DNVNode(graph);
          graph.addNode(0, node);
        }
        for(Pair<Integer, Integer> eIndex : tupos){
          DNVEdge edge = new DNVEdge(graph);
          edge.setFrom(graph.getNode(0, eIndex.getFirst() - minIndex));
          edge.setTo(graph.getNode(0, eIndex.getSecond() - minIndex));
          graph.addEdge(0, edge);
        }
        graph.writeGraph(path + "tupos_" + filename + ".dnv");
         
       
View Full Code Here

      int from;
      int to;
      String[] fromNodeInfo;
      String[] toNodeInfo;
      String[] edgeInfo;
      DNVEdge edge;
      DNVNode fromNode;
      DNVNode toNode;
      int lineIndex = 0;
      line = graphFileReader.readLine();
      while( line != null && !line.equals( "" ) )
      {
        lineTokenizer = new StringTokenizer( line );
        from = Integer.parseInt( lineTokenizer.nextToken() );
        to = Integer.parseInt( lineTokenizer.nextToken() );

        fromNodeInfo = (String[])nodeFileList.get( from - 1 );
        fromNode = (DNVNode)graph.getNodeByBbId( fromNodeInfo[1] );
        if( fromNode == null )
        {
          fromNode = new DNVNode( graph );
          fromNode.setLabel( fromNodeInfo[0] );
          fromNode.setBbId( fromNodeInfo[1] );
          fromNode.setPosition( (float)Math.random(), (float)Math.random() );
          graph.addNode( 0, fromNode );
        }

        toNodeInfo = (String[])nodeFileList.get( to - 1 );
        toNode = (DNVNode)graph.getNodeByBbId( toNodeInfo[1] );
        if( toNode == null )
        {
          toNode = new DNVNode( graph );
          toNode.setLabel( toNodeInfo[0] );
          toNode.setBbId( toNodeInfo[1] );
          toNode.setPosition( (float)Math.random(), (float)Math.random() );
          graph.addNode( 0, toNode );
        }

        edgeInfo = (String[])linkFileList.get( lineIndex );
        edge = new DNVEdge( fromNode, toNode, graph );
        edge.setLabel( edgeInfo[1] + ", " + edgeInfo[3] + ", " + edgeInfo[5] + ", " + edgeInfo[6] + ", " + edgeInfo[7] );
        graph.addNode( 0, edge );

        line = graphFileReader.readLine();
        lineIndex++;
      }
View Full Code Here

   *
   * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
   */
  public int compare( DNVNode node0, DNVNode node1 )
  {
    DNVEdge dnvEdge0 = GraphFunctions.getEdgeToNodeOfType( node0.getGraph(), node0, "Active_user" );
    double distance0;
    if( dnvEdge0 != null )
      distance0 = dnvEdge0.getRestingDistance();
    else
      distance0 = Double.POSITIVE_INFINITY;

    DNVEdge dnvEdge1 = GraphFunctions.getEdgeToNodeOfType( node1.getGraph(), node1, "Active_user" );
    double distance1;
    if( dnvEdge1 != null )
      distance1 = dnvEdge1.getRestingDistance();
    else
      distance1 = Double.POSITIVE_INFINITY;

    if( distance0 < distance1 )
      return -1;
View Full Code Here

TOP

Related Classes of net.wigis.graph.dnv.DNVEdge

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.