uchicago.src.sim.network
Class PajekNetReader

java.lang.Object
  extended by uchicago.src.sim.network.PajekNetReader

public class PajekNetReader
extends java.lang.Object

Class for constructing networks from text files in Pajek's *.net Arc/Edge list file format. Will not read Pajek Arclist/Edgelist format, or Pajek matrix format. Requires that if "*Arcs" and "*Edges" both exist in file, "*Arcs" must be before "*Edges" (this is Pajek's default).

Pajek is Windows-based freeware, written by Vladimir Batagelj and Andrej Mrvar,University of Ljubljana,Slovenia downloadable from: http://vlado.fmf.uni-lj.si/pub/networks/pajek/

currently does not read colors, edge widths, node sizes, etc..

Version:
$Revision: 1.7 $ $Date: 2004/11/03 19:51:01 $
Author:
Skye Bender-deMoll e-mail skyebend@santafe.edu

Constructor Summary
PajekNetReader(java.lang.String fileAndPath)
           
 
Method Summary
 java.util.List getDrawableNetwork(java.lang.Class nodeClass, java.lang.Class edgeClass, int spaceWidth, int spaceHeight)
          Returns a list of nodes of type nodeClass forming network corresponding to the *.net file with edges of class edgeClass and strength corresponding to the arcs and edges in the file.
 java.util.List getNetwork(java.lang.Class nodeClass, java.lang.Class edgeClass)
          Returns a list of nodes of type nodeClass forming network corresponding to the *.net file with edges of class edgeClass and with strengths corresponding to the arcs and edges in the file
 int[] getXY(Node node)
          Returns an int[x,y] with the coordinates of the node if they were read from the Pajek *.net file.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PajekNetReader

public PajekNetReader(java.lang.String fileAndPath)
Method Detail

getNetwork

public java.util.List getNetwork(java.lang.Class nodeClass,
                                 java.lang.Class edgeClass)
                          throws java.io.IOException
Returns a list of nodes of type nodeClass forming network corresponding to the *.net file with edges of class edgeClass and with strengths corresponding to the arcs and edges in the file

Parameters:
nodeClass - the class to construct nodes from. Must implement Node and have no-argument constructor
edgeClass - the class to construct nodes from. Must implement Edge and have no-argument constructor
Throws:
java.io.IOException

getDrawableNetwork

public java.util.List getDrawableNetwork(java.lang.Class nodeClass,
                                         java.lang.Class edgeClass,
                                         int spaceWidth,
                                         int spaceHeight)
                                  throws java.io.IOException
Returns a list of nodes of type nodeClass forming network corresponding to the *.net file with edges of class edgeClass and strength corresponding to the arcs and edges in the file. Coordinates of nodes are parsed from file, and can be accessed via getXY(Node node) when constructing wrapper classes spaceWidth and spaceHeight are needed to rescale the Pajek coordinates to values used by repast.

Parameters:
nodeClass - the class to construct nodes from. Must implement Node and have no-argument constructor
edgeClass - the class to construct nodes from. Must implement Edge and have no-argument constructor
spaceWidth - the horizontal dimension of the display in pixels
spaceHeight - the vertical dimension of the display in pixels
Throws:
java.io.IOException

getXY

public int[] getXY(Node node)
Returns an int[x,y] with the coordinates of the node if they were read from the Pajek *.net file. Otherwise returns [0,0]

Parameters:
node - the node (must be of class nodeClass) to return x and y for