|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectgps.network.graph.Graph
public class Graph
graph is an object representing network topology. this file is based on KOM / LetsQoS Topology Conversion Tools. Two ways to add a node: Instanciate a Node object and call graph.addNode() to get back the key of the node. Or call graph.newNode() to get back a new node that is already added to the graph. Same for adding new links.
| Constructor Summary | |
|---|---|
Graph()
Creates new Graph |
|
| Method Summary | |
|---|---|
int |
addLink(Link l)
add link |
int |
addNode(Node n)
add a node to the graph |
static Graph |
fromALTFile(java.io.BufferedReader r)
Read from a file in the ALT topology file format |
static Graph |
fromALTFile(java.io.File file)
Read from a file in the ALT topology file format |
static Graph |
fromALTFile(java.lang.String filename)
Read from a file in the ALT topology file format |
static Graph |
fromBRITEFile(java.io.BufferedReader r)
Read from a file in the BRITE topology file format |
static Graph |
fromBRITEFile(java.io.File file)
Read from a file in the BRITE topology file format |
static Graph |
fromBRITEFile(java.lang.String filename)
Read from a file in the BRITE topology file format |
static Graph |
fromCSVFile(java.io.BufferedReader r)
Read from a file in the CVS topology file format |
static Graph |
fromCSVFile(java.io.File file)
Read from a file in the CVS topology file format |
static Graph |
fromCSVFile(java.lang.String filename)
Read from a file in the CVS topology file format |
static Graph |
fromGMLFile(java.io.BufferedInputStream r)
Read from a file in the GML topology file format |
static Graph |
fromGMLFile(java.io.File file)
Read from a file in the GML topology file format |
static Graph |
fromGMLFile(java.lang.String filename)
Read from a file in the GML topology file format |
static Graph |
fromGTTSFile(java.io.BufferedReader r)
Read from a file in the GTTS topology file format |
static Graph |
fromGTTSFile(java.io.File file)
Read from a file in the GTTS topology file format |
static Graph |
fromGTTSFile(java.lang.String filename)
Read from a file in the GTTS topology file format |
static Graph |
fromINETFile(java.io.BufferedReader r)
Read from a file in the INET topology file format |
static Graph |
fromINETFile(java.io.File file)
Read from a file in the INET topology file format |
static Graph |
fromINETFile(java.lang.String filename)
Read from a file in the INET topology file format |
static Graph |
fromNLANRFile(java.io.BufferedReader r)
Read from a file in the NLANR topology file format |
static Graph |
fromNLANRFile(java.io.File file)
Read from a file in the NLANR topology file format |
static Graph |
fromNLANRFile(java.lang.String filename)
Read from a file in the NLANR topology file format |
static Graph |
fromTIERSFile(java.io.BufferedReader r)
Read from a file in the TIERS topology file format |
static Graph |
fromTIERSFile(java.io.File file)
Read from a file in the TIERS topology file format |
static Graph |
fromTIERSFile(java.lang.String filename)
Read from a file in the TIERS topology file format |
Link[] |
getAllLinks()
gets all links |
Node[] |
getAllNodes()
gets all nodes |
java.lang.String |
getComment()
gets comment |
java.lang.String |
getCreator()
gets creator |
java.lang.String |
getGraphFile()
gets file path |
Link |
getLink(int key)
gets link |
Node |
getNode(int key)
Retrieve a node |
int |
getNumberOfLinks()
gets number of links |
int |
getNumberOfNodes()
gets number of nodes |
boolean |
isValid()
check validity |
static void |
main(java.lang.String[] args)
command line converter |
Link |
newDirectedLink(int fromNode,
int toNode)
adds directed link |
Node |
newNode()
creates a new Node that is already element of the graph (no need to call addNode()) |
Link |
newUndirectedLink(int fromNode,
int toNode)
adds undirected link |
void |
setComment(java.lang.String comment)
sets comment |
void |
setCreator(java.lang.String creator)
sets creator |
void |
setGraphFile(java.lang.String f)
sets file path |
java.lang.String |
toString()
converting the graph into a human readable string |
void |
writeToGML(java.io.File f)
write to a file in the GML topology file format |
void |
writeToGML(java.lang.String filename)
write to a file in the GML topology file format |
void |
writeToNS2(java.io.File f)
write to a file in the NS2 script |
void |
writeToNS2(java.lang.String filename)
write to a file in the NS2 script |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public Graph()
| Method Detail |
|---|
public java.lang.String getGraphFile()
public void setGraphFile(java.lang.String f)
f - file pathpublic boolean isValid()
public java.lang.String getComment()
public void setComment(java.lang.String comment)
comment - new commentpublic java.lang.String getCreator()
public void setCreator(java.lang.String creator)
creator - new creatorpublic int addNode(Node n)
n - new node
public Node newNode()
public Node getNode(int key)
key - node id
public int getNumberOfNodes()
public Link newUndirectedLink(int fromNode,
int toNode)
fromNode - source nodetoNode - destination node
public Link newDirectedLink(int fromNode,
int toNode)
fromNode - source nodetoNode - destination node
public int addLink(Link l)
l - link
public Link getLink(int key)
key - key of the link
public int getNumberOfLinks()
public Link[] getAllLinks()
public Node[] getAllNodes()
public java.lang.String toString()
toString in class java.lang.Object
public static Graph fromGMLFile(java.lang.String filename)
throws java.io.IOException,
GraphException
filename - file name
java.io.IOException
GraphException
public static Graph fromGMLFile(java.io.File file)
throws java.io.IOException,
GraphException
file - File object
java.io.IOException
GraphException
public static Graph fromGMLFile(java.io.BufferedInputStream r)
throws java.io.IOException,
GraphException
r - buffered input stream
java.io.IOException
GraphException
public void writeToGML(java.lang.String filename)
throws java.io.IOException,
GraphException
filename - file name
java.io.IOException
GraphException
public void writeToGML(java.io.File f)
throws java.io.IOException,
GraphException
f - File object
java.io.IOException
GraphException
public void writeToNS2(java.lang.String filename)
throws java.io.IOException,
GraphException
filename - file name
java.io.IOException
GraphException
public void writeToNS2(java.io.File f)
throws java.io.IOException,
GraphException
f - File object
java.io.IOException
GraphException
public static Graph fromBRITEFile(java.lang.String filename)
throws java.io.IOException,
GraphException
filename - file name
java.io.IOException
GraphException
public static Graph fromBRITEFile(java.io.File file)
throws java.io.IOException,
GraphException
file - File object
java.io.IOException
GraphException
public static Graph fromBRITEFile(java.io.BufferedReader r)
throws java.io.IOException,
GraphException
r - buffered reader
java.io.IOException
GraphException
public static Graph fromALTFile(java.lang.String filename)
throws java.io.IOException,
GraphException
filename - file name
java.io.IOException
GraphException
public static Graph fromALTFile(java.io.File file)
throws java.io.IOException,
GraphException
file - File object
java.io.IOException
GraphException
public static Graph fromALTFile(java.io.BufferedReader r)
throws java.io.IOException,
GraphException
r - buffered reader
java.io.IOException
GraphException
public static Graph fromTIERSFile(java.lang.String filename)
throws java.io.IOException,
GraphException
filename - file name
java.io.IOException
GraphException
public static Graph fromTIERSFile(java.io.File file)
throws java.io.IOException,
GraphException
file - File object
java.io.IOException
GraphException
public static Graph fromTIERSFile(java.io.BufferedReader r)
throws java.io.IOException,
GraphException
r - buffered reader
java.io.IOException
GraphException
public static Graph fromGTTSFile(java.lang.String filename)
throws java.io.IOException,
GraphException
filename - file name
java.io.IOException
GraphException
public static Graph fromGTTSFile(java.io.File file)
throws java.io.IOException,
GraphException
file - File object
java.io.IOException
GraphException
public static Graph fromGTTSFile(java.io.BufferedReader r)
throws java.io.IOException,
GraphException
r - buffered reader
java.io.IOException
GraphException
public static Graph fromINETFile(java.lang.String filename)
throws java.io.IOException,
GraphException
filename - file name
java.io.IOException
GraphException
public static Graph fromINETFile(java.io.File file)
throws java.io.IOException,
GraphException
file - File object
java.io.IOException
GraphException
public static Graph fromINETFile(java.io.BufferedReader r)
throws java.io.IOException,
GraphException
r - buffered reader
java.io.IOException
GraphException
public static Graph fromNLANRFile(java.lang.String filename)
throws java.io.IOException,
GraphException
filename - file name
java.io.IOException
GraphException
public static Graph fromNLANRFile(java.io.File file)
throws java.io.IOException,
GraphException
file - File object
java.io.IOException
GraphException
public static Graph fromNLANRFile(java.io.BufferedReader r)
throws java.io.IOException,
GraphException
r - buffered reader
java.io.IOException
GraphException
public static Graph fromCSVFile(java.lang.String filename)
throws java.io.IOException,
GraphException
filename - file name
java.io.IOException
GraphException
public static Graph fromCSVFile(java.io.File file)
throws java.io.IOException,
GraphException
file - File object
java.io.IOException
GraphException
public static Graph fromCSVFile(java.io.BufferedReader r)
throws java.io.IOException,
GraphException
r - buffered reader
java.io.IOException
GraphExceptionpublic static void main(java.lang.String[] args)
args - arguments
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||