{
System.out.println();
System.out.println( filename );
DNVGraph tempGraph = new DNVGraph( directory + filename );
List<DNVNode> nodes = tempGraph.getNodes( 0 );
DNVNode newNode;
for( DNVNode node : nodes )
{
if( node.getBbId() != null && !node.getBbId().equals("") )
{
System.out.println( "Friend" );
System.out.println( node.getLabel() );
if( graph.getNodeByBbId( node.getLabel() ) == null )
{
newNode = new DNVNode(graph);
newNode.setLabel( node.getLabel() );
newNode.setBbId( node.getLabel() );
newNode.setColor( 0.5f, 0.5f, 1 );
newNode.setPosition( (float)Math.random(), (float)Math.random() );
newNode.setType( "person" );
graph.addNode( 0, newNode );
}
}
else
{
if( !ignoreItems )
{
System.out.println( "Item" );
System.out.println( node.getLabel() );
if( graph.getNodeByBbId( node.getLabel() ) == null )
{
newNode = new DNVNode(graph);
newNode.setLabel( node.getLabel() );
newNode.setBbId( node.getLabel() );
newNode.setColor( 1.0f, 1.0f, 0 );
newNode.setPosition( (float)Math.random(), (float)Math.random() );
newNode.setType( "item" );
graph.addNode( 0, newNode );
}
}
}
}
List<DNVEdge> edges = tempGraph.getEdges( 0 );
for( DNVEdge edge : edges )
{
System.out.println( edge.getFrom().getLabel() + "->" + edge.getTo().getLabel() );
if( graph.getNodeByBbId( edge.getFrom().getLabel() + "->" + edge.getTo().getLabel() ) == null )
{
DNVNode fromNode = (DNVNode)graph.getNodeByBbId( edge.getFrom().getLabel() );
DNVNode toNode = (DNVNode)graph.getNodeByBbId( edge.getTo().getLabel() );
if( fromNode != null && toNode != null )
{
DNVEdge newEdge = new DNVEdge( fromNode, toNode, graph );
newEdge.setBbId( fromNode.getLabel() + "->" + toNode.getLabel() );
newEdge.setType( "likes" );
graph.addEntity( 0, newEdge );
}
}
}
if( generateFriendEdges )
{
DNVNode tempUserNode = (DNVNode)tempGraph.getNodesByType( 0, "user" ).get( 0 );
if( tempUserNode != null )
{
DNVNode userNode = (DNVNode)graph.getNodeByBbId( tempUserNode.getLabel() );
Map<Integer,DNVEntity> friends = tempGraph.getNodesByType( 0, "friend" );
for( DNVEntity friend : friends.values() )
{
DNVNode friendNode = (DNVNode)graph.getNodeByBbId( friend.getLabel() );
DNVEdge newEdge = new DNVEdge( userNode, friendNode, graph );
newEdge.setBbId( userNode.getLabel() + "->" + friendNode.getLabel() );
newEdge.setType( "friendEdge" );
graph.addEntity( 0, newEdge );
}
}
}