<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to Using</title><link>https://sourceforge.net/p/spargel/wiki/Using/</link><description>Recent changes to Using</description><atom:link href="https://sourceforge.net/p/spargel/wiki/Using/feed" rel="self"/><language>en</language><lastBuildDate>Wed, 14 Aug 2013 09:30:11 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/spargel/wiki/Using/feed" rel="self" type="application/rss+xml"/><item><title>Using modified by Philipp Hülsdunk</title><link>https://sourceforge.net/p/spargel/wiki/Using/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v19
+++ v20
@@ -4,14 +4,14 @@
 The first step to be is to create a graph. The graph classes are included in the [datastructues] package. To create an undirected graph that uses an adjacency list you should write:

 ~~~~~~
-#!/usr/bin/java
+:::java
 UAdjListGraph g = new UAdjListGraph();
 ~~~~~~

 Vertices and edges can be constructed using the graph:

 ~~~~~~
-#!/usr/bin/java
+:::java
 UAdjListGraph.Vertice v1 = g.createVertex();
 //...
 UAdjListGraph.Edge e1 = g.createEdge(v1, v2);
@@ -21,7 +21,7 @@
 To make things interesting, we can assign values to vertices and edges. For example, we can add weights to the edges. This is done by creating an edge map, which will work for us as a property map having improved runtime accessing edges as keys:

 ~~~~~~
-#!/usr/bin/java
+:::java
 Map weightMap = g.createEdgeMap();
 weightMap.put(e1, 2.4);
 ~~~~~~
@@ -31,7 +31,7 @@
 Running [algorithms] is easy, they are methods with the graph and transformers as parameters. Transformers will form a vertex or edge to a certain value, for example, Dijkstra's algorithm will be passed a transformer forming from an edge a value for its weight. Since we have saved our weights into a map we can wrap this instance into a MapTransformer to get the desired transformer:

 ~~~~~~
-#!/usr/bin/java
+:::java
 DistanceVector paths = SingleSourceShortestPath.Dijkstra(
         g, new MapTransformer(weightMap), v1);
 List pathToV2 = paths.getPathTo(v2);
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Philipp Hülsdunk</dc:creator><pubDate>Wed, 14 Aug 2013 09:30:11 -0000</pubDate><guid>https://sourceforge.net9da0cf5d4d01948ee777a4d62f96b1bc93967c00</guid></item><item><title>Using modified by Philipp Hülsdunk</title><link>https://sourceforge.net/p/spargel/wiki/Using/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v18
+++ v19
@@ -1,39 +1,39 @@
 Using
 =====

-The first step to be is to create a graph. The graph classes are included in the [datastructues] package. To create an undirected graph that uses an adjecency list you should write:
+The first step to be is to create a graph. The graph classes are included in the [datastructues] package. To create an undirected graph that uses an adjacency list you should write:

 ~~~~~~
 #!/usr/bin/java
 UAdjListGraph g = new UAdjListGraph();
 ~~~~~~

-This graph just represents the relationship between vertices and edges. To create a vertice and edge mapping will assign values to the vertices and edges.
+Vertices and edges can be constructed using the graph:

 ~~~~~~
 #!/usr/bin/java
-Map nameMap = g.createVerticeMap();
-Map weightMap = g.createEdgeMap();
+UAdjListGraph.Vertice v1 = g.createVertex();
+//...
+UAdjListGraph.Edge e1 = g.createEdge(v1, v2);
+//...
 ~~~~~~

-The nameMap will simply be an array of strings since the vertices are wrappers around integers (Of course if the UAdjListGraph is being used). The weightMap will be a two dimensional array, similar to an adjecency list, saving a Double as weight into it. Also, the nameMap and weightMap communicate with g: If a vertice or edge is being constructed or removed those mappings will allocate/deallocate memory for saving the mapped value.
-Manipulation of the graph can be done as in following example:
+To make things interesting, we can assign values to vertices and edges. For example, we can add weights to the edges. This is done by creating an edge map, which will work for us as a property map having improved runtime accessing edges as keys:

 ~~~~~~
 #!/usr/bin/java
-UAdjListGraph.Vertice v1 = g.createVertice();
-nameMap.put(v1, "First vertice");
-//...
-UAdjListGraph.Edge e1 = g.createEdge(v1, v2);
-weightMap.put(e1, 12.5);
+Map weightMap = g.createEdgeMap();
+weightMap.put(e1, 2.4);
 ~~~~~~

-Note that reading and writing of graphs can be also done from and into (file) streams. See [readers] and [writers] for this purpose.
-As the graph is now created, [algorithms] can be run on them. For running Dijkstra's single-source-shortest-path algorithm on a graph use:
+We can also do the same thing with vertices by calling g.createVertexMap().
+
+Running [algorithms] is easy, they are methods with the graph and transformers as parameters. Transformers will form a vertex or edge to a certain value, for example, Dijkstra's algorithm will be passed a transformer forming from an edge a value for its weight. Since we have saved our weights into a map we can wrap this instance into a MapTransformer to get the desired transformer:

 ~~~~~~
 #!/usr/bin/java
-DistanceVector paths = SingleSourceShortestPath.Dijkstra(g, weightMap, v1);
+DistanceVector paths = SingleSourceShortestPath.Dijkstra(
+        g, new MapTransformer(weightMap), v1);
 List pathToV2 = paths.getPathTo(v2);
 List pathToV3 = paths.getPathTo(v3);
 ~~~~~~
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Philipp Hülsdunk</dc:creator><pubDate>Wed, 14 Aug 2013 09:26:57 -0000</pubDate><guid>https://sourceforge.net2ea357a2f9bf59cf0a0d23cfab2ea1e40e7145df</guid></item><item><title>Using modified by Philipp Hülsdunk</title><link>https://sourceforge.net/p/spargel/wiki/Using/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v17
+++ v18
@@ -33,7 +33,7 @@

 ~~~~~~
 #!/usr/bin/java
-SSSPPaths paths = SingleSourceShortestPath.Dijkstra(g, weightMap, v1);
+DistanceVector paths = SingleSourceShortestPath.Dijkstra(g, weightMap, v1);
 List pathToV2 = paths.getPathTo(v2);
 List pathToV3 = paths.getPathTo(v3);
 ~~~~~~
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Philipp Hülsdunk</dc:creator><pubDate>Wed, 10 Apr 2013 13:02:55 -0000</pubDate><guid>https://sourceforge.net11ee77dc14645479532ee17f4b92a776fd515030</guid></item><item><title>Using modified by Philipp Hülsdunk</title><link>https://sourceforge.net/p/spargel/wiki/Using/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v16
+++ v17
@@ -27,3 +27,13 @@
 UAdjListGraph.Edge e1 = g.createEdge(v1, v2);
 weightMap.put(e1, 12.5);
 ~~~~~~
+
+Note that reading and writing of graphs can be also done from and into (file) streams. See [readers] and [writers] for this purpose.
+As the graph is now created, [algorithms] can be run on them. For running Dijkstra's single-source-shortest-path algorithm on a graph use:
+
+~~~~~~
+#!/usr/bin/java
+SSSPPaths paths = SingleSourceShortestPath.Dijkstra(g, weightMap, v1);
+List pathToV2 = paths.getPathTo(v2);
+List pathToV3 = paths.getPathTo(v3);
+~~~~~~
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Philipp Hülsdunk</dc:creator><pubDate>Wed, 03 Apr 2013 17:15:05 -0000</pubDate><guid>https://sourceforge.netf762f5271b7d846889c8ac0741da73c696d0c9cd</guid></item><item><title>Using modified by Philipp Hülsdunk</title><link>https://sourceforge.net/p/spargel/wiki/Using/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v15
+++ v16
@@ -1,41 +1,29 @@
-Using SPARGEL
-==============
+Using
+=====

-
-We designed spargel to support as mostly all graph types that are possible. For that reason, graphs are seperated into [datastructures] and [properties]. The datastructures package defines classes that can be used to create simple graphs:
+The first step to be is to create a graph. The graph classes are included in the [datastructues] package. To create an undirected graph that uses an adjecency list you should write:

 ~~~~~~
 #!/usr/bin/java
-AdjListGraph g1 = new AdjListGraph();
-BidirectionalAdjListGraph g2 = new BidirectionalAdjListGraph();
-UndirectedAdjListGraph g2 = new UndirectedAdjListGraph();
+UAdjListGraph g = new UAdjListGraph();
 ~~~~~~

-In the above example three graphs that use an adjecency list are created. The first one is the simpliest form, it allows only access the edges going out from a vertice. The bidirectional graph also allows the access to the predecessors. gs, the last graph, is one that is undirected.
-
-These graphs are now just a relationship between vertices and edges. Adding properties to the graph makes them extensionable:
+This graph just represents the relationship between vertices and edges. To create a vertice and edge mapping will assign values to the vertices and edges.

 ~~~~~~
 #!/usr/bin/java
-public class SampleGraph extends UndirectedAdjListGraph {
-
-    public SampleGraph() {
-        _weightProperty = new EdgeProperty&lt;pre&gt;();
-    }
-
-    public EdgeProperty getWeightProperty() {
-        return _weightProperty;
-    }
-    private EdgeProperty _weightProperty;
-}
+Map nameMap = g.createVerticeMap();
+Map weightMap = g.createEdgeMap();
 ~~~~~~

-Here we added an weight property for the edges. Via the EdgeProperty class the property values can be read or modified.
-
-The algorithms in spargel will use the properties. They can be passed as argument to the algorithm's method:
+The nameMap will simply be an array of strings since the vertices are wrappers around integers (Of course if the UAdjListGraph is being used). The weightMap will be a two dimensional array, similar to an adjecency list, saving a Double as weight into it. Also, the nameMap and weightMap communicate with g: If a vertice or edge is being constructed or removed those mappings will allocate/deallocate memory for saving the mapped value.
+Manipulation of the graph can be done as in following example:

 ~~~~~~
 #!/usr/bin/java
-HashMap previousMap =
-        ShortestPath.Dijkstra(graph, graph.getWeightProperty(), start);
+UAdjListGraph.Vertice v1 = g.createVertice();
+nameMap.put(v1, "First vertice");
+//...
+UAdjListGraph.Edge e1 = g.createEdge(v1, v2);
+weightMap.put(e1, 12.5);
 ~~~~~~
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Philipp Hülsdunk</dc:creator><pubDate>Wed, 03 Apr 2013 16:50:50 -0000</pubDate><guid>https://sourceforge.netac5227d985e140a94ba8a44350b95059bd54b6dd</guid></item><item><title>WikiPage Using modified by Philipp Hülsdunk</title><link>https://sourceforge.net/p/spargel/wiki/Using/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v14
+++ v15
@@ -37,5 +37,5 @@
 ~~~~~~
 #!/usr/bin/java
 HashMap previousMap =
-        ShortestPath.Dijkstra(graph, graph.getLengthProperty(), start);
+        ShortestPath.Dijkstra(graph, graph.getWeightProperty(), start);
 ~~~~~~
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Philipp Hülsdunk</dc:creator><pubDate>Mon, 25 Mar 2013 22:31:15 -0000</pubDate><guid>https://sourceforge.net8363c5db032d741abe8c798bb7a2303ec300d10c</guid></item><item><title>WikiPage Using modified by Philipp Hülsdunk</title><link>https://sourceforge.net/p/spargel/wiki/Using/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v13
+++ v14
@@ -2,149 +2,40 @@
 ==============

-Creating a custom graph
------------------------
+We designed spargel to support as mostly all graph types that are possible. For that reason, graphs are seperated into [datastructures] and [properties]. The datastructures package defines classes that can be used to create simple graphs:

 ~~~~~~
 #!/usr/bin/java
+AdjListGraph g1 = new AdjListGraph();
+BidirectionalAdjListGraph g2 = new BidirectionalAdjListGraph();
+UndirectedAdjListGraph g2 = new UndirectedAdjListGraph();
+~~~~~~

-import datastructures.AdjEdge;
-import datastructures.AdjGraph;
-import datastructures.AdjVertice;
-import delegates.GeometricGraphDelegate;
-import interfaces.GeometricEdge;
-import interfaces.GeometricVertice;
+In the above example three graphs that use an adjecency list are created. The first one is the simpliest form, it allows only access the edges going out from a vertice. The bidirectional graph also allows the access to the predecessors. gs, the last graph, is one that is undirected.

-/**
- * This is the first example on writing a custom graph.
- *
- * This example should be read carefully and should be used as an entry point
- * for using spargel.
- *
- * This example introduces the concepts of the datastructures, interfaces and
- * delegates for creating a custom graph class.
- *
- * The datastructures package should be used to inherit your custom graph,
- * vertice and edge from. For example, using the AdjGraph, AdjVertice and
- * AdjEdge class, a custom graph can be created using an adjecency list to save
- * the graph.
- *
- * Interfaces in spargel represent the features a graph will have. They will be
- * used by the algorithms, readers and writers packages for doing operations on
- * them. Thus, when writing a custom graph, you should provide an implements
- * statement on the vertices and edges with a generic parameter to them selves.
- *
- * The actual implementation of the provided interface is done by delegates. A
- * good practice is to put the vertice and edge class inside the graph class,
- * which holds the delegate. Thus, you can easily access the delegate from the
- * vertice and edge classes. Now, the implementation of the interface methods
- * can be forwarded to the delegate.
- *
- * @author Philipp Hülsdunk
- */
-public class CustomGraph
-        extends AdjGraph {
+These graphs are now just a relationship between vertices and edges. Adding properties to the graph makes them extensionable:

-    /**
-     * This is the custom vertice.
-     *
-     * It extends from AdjVertice for using a adjecency list to save it. It
-     * implements a GeometricVertice, so, the custom graph is an geometric one.
-     * The implemented methods will foreward their requests to the delegate
-     * saved in CustomGraph.
-     */
-    public class CustomVertice
-            extends AdjVertice
-            implements GeometricVertice {
+~~~~~~
+#!/usr/bin/java
+public class SampleGraph extends UndirectedAdjListGraph {

-        @Override
-        public void setPosition(int index, Number coord) {
-            _geomDelegate.setPosition(this, index, coord);
-        }
-
-        @Override
-        public Number getPosition(int index) {
-            return _geomDelegate.getPosition(this, index);
-        }
-
-        @Override
-        public void setPosition(Number[] pos) {
-            _geomDelegate.setPosition(this, pos);
-        }
-
-        @Override
-        public Number[] getPosition() {
-            return _geomDelegate.getPosition(this);
-        }
+    public SampleGraph() {
+        _weightProperty = new EdgeProperty();
     }

-    /**
-     * This is the CustomEdge.
-     *
-     * It also inherits from the same datastructrue bundle AdjEdge. It also
-     * implements the GeometricEdge which is needed when using the
-     * GeometricVertice. Also, forewarding the requests from that interface to
-     * the delegate.
-     */
-    public class CustomEdge
-            extends AdjEdge
-            implements GeometricEdge,
-            WeightedEdge {
-        
-        @Override
-        public Number getLength() {
-            return _geomDelegate.getLength(this);
-        }
-        
-        @Override
-        public Number getWeight() {
-            return _geomDelegate.getLength(this);
-        }
+    public EdgeProperty getWeightProperty() {
+        return _weightProperty;
     }
-
-    /**
-     * This is the constructor of our custom graph.
-     *
-     * The only thing needed here is to tell the datastructure AdjGraph which
-     * constructors it will need and initializing the delegate.
-     */
-    public CustomGraph() {
-        super(CustomVertice.class, CustomEdge.class);
-        _geomDelegate = new GeometricGraphDelegate();
-    }
-    /**
-     * This is the delegate for having a geometric graph.
-     */
-    private GeometricGraphDelegate _geomDelegate;
+    private EdgeProperty _weightProperty;
 }
 ~~~~~~

+Here we added an weight property for the edges. Via the EdgeProperty class the property values can be read or modified.

-Reading a graph
----------------
-
-Reading is one easy thing, once you have created your own graph class. The readers package provide many classes to construct a graph. Here is an example reading a graph from a csv file.
+The algorithms in spargel will use the properties. They can be passed as argument to the algorithm's method:

 ~~~~~~
 #!/usr/bin/java
-
-InputStream is; // Create a input stream from the file
-CustomGraph graph = new CustomGraph();
-Reader reader = new CsvReader(is);
-reader.read(graph);
+HashMap previousMap =
+        ShortestPath.Dijkstra(graph, graph.getLengthProperty(), start);
 ~~~~~~
-
-Operating on the graph
-----------------------
-
-Operators on the graph are all written using the interface package. So as long your custom graph supports these, you can use the operators on them. Here is an example using the algorithms package:
-
-~~~~~~
-#!/usr/bin/java
-
-
-HashMap previousMap =
-                ShortestPath.Dijkstra(graph, graph.getVertice(0));
-~~~~~~
-
-The returned map can be used to backtrace a shortest path to the passed start.
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Philipp Hülsdunk</dc:creator><pubDate>Mon, 25 Mar 2013 22:30:34 -0000</pubDate><guid>https://sourceforge.net2f75cab8192f2f9eac9a24ef287f35f963b6314f</guid></item><item><title>WikiPage Using modified by Philipp Hülsdunk</title><link>https://sourceforge.net/p/spargel/wiki/Using/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v12
+++ v13
@@ -86,7 +86,7 @@
      * GeometricVertice. Also, forewarding the requests from that interface to
      * the delegate.
      */
-        public class CustomEdge
+    public class CustomEdge
             extends AdjEdge
             implements GeometricEdge,
             WeightedEdge {
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Philipp Hülsdunk</dc:creator><pubDate>Thu, 21 Mar 2013 16:24:25 -0000</pubDate><guid>https://sourceforge.net481fb35c755ed9664576dfb164c73fca7fbe0f28</guid></item><item><title>WikiPage Using modified by Philipp Hülsdunk</title><link>https://sourceforge.net/p/spargel/wiki/Using/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v11
+++ v12
@@ -2,151 +2,149 @@
 ==============

-Warning
---------
-NOTE: SPARGEL is currently in planning stage and you should NOT yet integrate it into your software because major changes to the interfaces **will** happen within the next few weeks. This information is intended only for people who help with the development of SPARGEL. Do NOT use this in production code or rely on it in any way! You have been warned.
-
-
-Getting a copy of SPARGEL
---------------------------
-
-SPARGEL is currently distributed as the source code from SVN. Project files for the NetBeans IDE are included, so you could easily build your own JAR files from the code with a single click.
-
-In the future, we may also provide JAR files as downloads in the Files section of this website.
-
-
-Adding SPARGEL to your testing project
----------------------------------------
-
-To test and improve SPARGEL, you can add it to your project in NetBeans: In the *Projects* tab of Netbeans, right-click on your project and select *Project Properties* =&gt; *Libraries*.
-
-Currently it is suggested to add SPARGEL as a NetBeans project (*Add Project...*), because it is way easier to keep it up-to-date this way.
-
-Later, when the library is more mature and gets less changes, we will provide JAR files and you can then add it as a JAR.
-
-
-Getting started with SPARGEL
------------------------------
-
-Example 1:
-
-Creating a simple graph implementing a adjecency list.
-
-1. Implement the vertice type
+Creating a custom graph
+-----------------------

 ~~~~~~
-public class SimpleVertice extends AdjListVertice {}
-~~~~~~
+#!/usr/bin/java

-2. Implement the edge type
+import datastructures.AdjEdge;
+import datastructures.AdjGraph;
+import datastructures.AdjVertice;
+import delegates.GeometricGraphDelegate;
+import interfaces.GeometricEdge;
+import interfaces.GeometricVertice;

-~~~~~~
-public class SimpleEdge extends AdjListEdge implements
-        WeightedEdge {
-    void setWeight(double w) {
-        _w = w;
+/**
+ * This is the first example on writing a custom graph.
+ *
+ * This example should be read carefully and should be used as an entry point
+ * for using spargel.
+ *
+ * This example introduces the concepts of the datastructures, interfaces and
+ * delegates for creating a custom graph class.
+ *
+ * The datastructures package should be used to inherit your custom graph,
+ * vertice and edge from. For example, using the AdjGraph, AdjVertice and
+ * AdjEdge class, a custom graph can be created using an adjecency list to save
+ * the graph.
+ *
+ * Interfaces in spargel represent the features a graph will have. They will be
+ * used by the algorithms, readers and writers packages for doing operations on
+ * them. Thus, when writing a custom graph, you should provide an implements
+ * statement on the vertices and edges with a generic parameter to them selves.
+ *
+ * The actual implementation of the provided interface is done by delegates. A
+ * good practice is to put the vertice and edge class inside the graph class,
+ * which holds the delegate. Thus, you can easily access the delegate from the
+ * vertice and edge classes. Now, the implementation of the interface methods
+ * can be forwarded to the delegate.
+ *
+ * @author Philipp Hülsdunk
+ */
+public class CustomGraph
+        extends AdjGraph {
+
+    /**
+     * This is the custom vertice.
+     *
+     * It extends from AdjVertice for using a adjecency list to save it. It
+     * implements a GeometricVertice, so, the custom graph is an geometric one.
+     * The implemented methods will foreward their requests to the delegate
+     * saved in CustomGraph.
+     */
+    public class CustomVertice
+            extends AdjVertice
+            implements GeometricVertice {
+
+        @Override
+        public void setPosition(int index, Number coord) {
+            _geomDelegate.setPosition(this, index, coord);
+        }
+
+        @Override
+        public Number getPosition(int index) {
+            return _geomDelegate.getPosition(this, index);
+        }
+
+        @Override
+        public void setPosition(Number[] pos) {
+            _geomDelegate.setPosition(this, pos);
+        }
+
+        @Override
+        public Number[] getPosition() {
+            return _geomDelegate.getPosition(this);
+        }
     }
-    
-    @Override
-    public Number getWeight() {
-        return _w;
+
+    /**
+     * This is the CustomEdge.
+     *
+     * It also inherits from the same datastructrue bundle AdjEdge. It also
+     * implements the GeometricEdge which is needed when using the
+     * GeometricVertice. Also, forewarding the requests from that interface to
+     * the delegate.
+     */
+        public class CustomEdge
+            extends AdjEdge
+            implements GeometricEdge,
+            WeightedEdge {
+        
+        @Override
+        public Number getLength() {
+            return _geomDelegate.getLength(this);
+        }
+        
+        @Override
+        public Number getWeight() {
+            return _geomDelegate.getLength(this);
+        }
     }
-    
-    private double _w;
+
+    /**
+     * This is the constructor of our custom graph.
+     *
+     * The only thing needed here is to tell the datastructure AdjGraph which
+     * constructors it will need and initializing the delegate.
+     */
+    public CustomGraph() {
+        super(CustomVertice.class, CustomEdge.class);
+        _geomDelegate = new GeometricGraphDelegate();
+    }
+    /**
+     * This is the delegate for having a geometric graph.
+     */
+    private GeometricGraphDelegate _geomDelegate;
 }
 ~~~~~~

-3. Implement the graph type
+
+Reading a graph
+---------------
+
+Reading is one easy thing, once you have created your own graph class. The readers package provide many classes to construct a graph. Here is an example reading a graph from a csv file.

 ~~~~~~
-public class SimpleGraph extends AdjListGraph {
-    SimpleGraph() {
-        super(SimpleVertice.class, SimpleEdge.class);
-    }
-}
+#!/usr/bin/java
+
+InputStream is; // Create a input stream from the file
+CustomGraph graph = new CustomGraph();
+Reader reader = new CsvReader(is);
+reader.read(graph);
 ~~~~~~

-Calling the super constructor will tell the AdjListGraph which constructor for the vertices and edges will be used.
+Operating on the graph
+----------------------

-Now the SimpleGraph can be used:
+Operators on the graph are all written using the interface package. So as long your custom graph supports these, you can use the operators on them. Here is an example using the algorithms package:

 ~~~~~~
-SimpleGraph g;
+#!/usr/bin/java

-SimpleVertice v1 = g.addVertice();
-// ...

-SimpleEdge e1 = v1.addEdge(v2);
-e1.setWeight(3.4);
-// ...
-
-HashMap previousMap = ShortestPath.Dijkstra(g, v1);
+HashMap previousMap =
+                ShortestPath.Dijkstra(graph, graph.getVertice(0));
 ~~~~~~

-
-Once you have added SPARGEL to your project, you can create your own graph based on the interfaces and classes provided in the library. Have a look at the *clients* package within SPARGEL, it contains an example implementation of a protein ligand graph. It looks something like this:
-
-    #!/usr/bin/java
-    // Ignore the line above, it is for the Wiki's syntax highlighting only
-
-    /*
-     * This could be your client, a protein ligand graph class in the file 'PLGraph.java',
-     * which is part of your application 'yourgreatapp'.
-     */
-    package yourgreatapp.datastructures;
-
-    import molbi.spargel.datastructures.graphs.undirected.TypedGraphU;
-
-    /**
-     * A client that implements a Protein Ligand Graph. The vertices of this graph are
-     * of type VertexSSE (which is not shown here but could be anything). The class also
-     * saves graph metadata, i.e., the RCSB PDB identifier of the protein represented by 
-     * the protein graph. This graph is undirected.
-     */
-    public class PLGraph extends TypedGraphU {
-
-        // some constants
-        public static final int PLGRAPH_VERTEXTYPE_ALPHAHELIX = 1;
-        public static final int PLGRAPH_VERTEXTYPE_BETASTRAND = 2;
-        public static final int PLGRAPH_VERTEXTYPE_LIGAND = 3;
-        public static final int PLGRAPH_VERTEXTYPE_OTHER = 4;
-
-        public static final int PLGRAPH_EDGETYPE_NONE = 0;
-        public static final int PLGRAPH_EDGETYPE_PARALLEL = 1;
-        public static final int PLGRAPH_EDGETYPE_ANTIPARALLEL = 2;
-        public static final int PLGRAPH_EDGETYPE_MIXED = 3;
-        public static final int PLGRAPH_EDGETYPE_LIGAND = 4;
-
-    
-        /**
-         * The RCSB identifier of this protein. A 4-letter string, e.g., '7TIM'.
-         */
-        private String pdbid;
-        
-        /**
-         * Constructor which sets an empty PDB ID.
-         */    
-        public PLGraph() {
-            super();
-            this.pdbid = "";
-        }    
-        
-        /**
-         * Returns the RCSB PDB identifier of the protein represented by this graph.
-         * @return the RCBS PDB identifier
-         */
-        public String getPdbid() {
-            return pdbid;
-        }
-    
-        /**
-         * Sets the RCSB PDB identifier of the protein represented by this graph.
-         * @param pdbid the RCSB PDB identifier
-         */
-        public void setPdbid(String pdbid) {
-            this.pdbid = pdbid;
-        }
-    }
-
-
-
+The returned map can be used to backtrace a shortest path to the passed start.
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Philipp Hülsdunk</dc:creator><pubDate>Thu, 21 Mar 2013 16:22:36 -0000</pubDate><guid>https://sourceforge.netd182f25d4d0cda717ff5b06412808903e6c8ab38</guid></item><item><title>WikiPage Using modified by Philipp Hülsdunk</title><link>https://sourceforge.net/p/spargel/wiki/Using/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v10
+++ v11
@@ -27,6 +27,63 @@

 Getting started with SPARGEL
 -----------------------------
+
+Example 1:
+
+Creating a simple graph implementing a adjecency list.
+
+1. Implement the vertice type
+
+~~~~~~
+public class SimpleVertice extends AdjListVertice {}
+~~~~~~
+
+2. Implement the edge type
+
+~~~~~~
+public class SimpleEdge extends AdjListEdge implements
+        WeightedEdge {
+    void setWeight(double w) {
+        _w = w;
+    }
+    
+    @Override
+    public Number getWeight() {
+        return _w;
+    }
+    
+    private double _w;
+}
+~~~~~~
+
+3. Implement the graph type
+
+~~~~~~
+public class SimpleGraph extends AdjListGraph {
+    SimpleGraph() {
+        super(SimpleVertice.class, SimpleEdge.class);
+    }
+}
+~~~~~~
+
+Calling the super constructor will tell the AdjListGraph which constructor for the vertices and edges will be used.
+
+Now the SimpleGraph can be used:
+
+~~~~~~
+SimpleGraph g;
+
+SimpleVertice v1 = g.addVertice();
+// ...
+
+SimpleEdge e1 = v1.addEdge(v2);
+e1.setWeight(3.4);
+// ...
+
+HashMap previousMap = ShortestPath.Dijkstra(g, v1);
+~~~~~~
+
+
 Once you have added SPARGEL to your project, you can create your own graph based on the interfaces and classes provided in the library. Have a look at the *clients* package within SPARGEL, it contains an example implementation of a protein ligand graph. It looks something like this:

     #!/usr/bin/java
@@ -93,4 +150,3 @@

-
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Philipp Hülsdunk</dc:creator><pubDate>Mon, 18 Mar 2013 11:24:54 -0000</pubDate><guid>https://sourceforge.net25aa5c94a0f4f9e4dceb17c06df9bf7a3f6abc2c</guid></item></channel></rss>