You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by si...@apache.org on 2011/06/24 15:04:21 UTC
svn commit: r1139287 - in
/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph:
Graph.java model/BaseGraph.java
Author: simonetripodi
Date: Fri Jun 24 13:04:20 2011
New Revision: 1139287
URL: http://svn.apache.org/viewvc?rev=1139287&view=rev
Log:
added graph order and size reader methods
Modified:
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/Graph.java
commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/BaseGraph.java
Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/Graph.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/Graph.java?rev=1139287&r1=1139286&r2=1139287&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/Graph.java (original)
+++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/Graph.java Fri Jun 24 13:04:20 2011
@@ -40,6 +40,13 @@ public interface Graph<V extends Vertex,
Set<V> getVertices();
/**
+ * Returns the <i>order</i> of a Graph (the number of Vertices);
+ *
+ * @return the <i>order</i> of a Graph (the number of Vertices);
+ */
+ int getOrder();
+
+ /**
* Returns the total set of Edges in the graph.
*
* @return the total set of Edges in the graph.
@@ -47,6 +54,13 @@ public interface Graph<V extends Vertex,
Set<E> getEdges();
/**
+ * Returns the <i>size</i> of a Graph (the number of Edges)
+ *
+ * @return the <i>size</i> of a Graph (the number of Edges)
+ */
+ int getSize();
+
+ /**
* Returns all edges which touch this vertex, where the input vertex is in the edge head.
*
* @return all edges which touch this vertex, where the input vertex is in the edge head.
Modified: commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/BaseGraph.java
URL: http://svn.apache.org/viewvc/commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/BaseGraph.java?rev=1139287&r1=1139286&r2=1139287&view=diff
==============================================================================
--- commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/BaseGraph.java (original)
+++ commons/sandbox/graph/trunk/src/main/java/org/apache/commons/graph/model/BaseGraph.java Fri Jun 24 13:04:20 2011
@@ -57,6 +57,14 @@ public abstract class BaseGraph<V extend
/**
* {@inheritDoc}
*/
+ public final int getOrder()
+ {
+ return adjacencyList.size();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public final Set<E> getEdges()
{
return unmodifiableSet( new HashSet<E>( indexedEdges.values() ) );
@@ -65,6 +73,14 @@ public abstract class BaseGraph<V extend
/**
* {@inheritDoc}
*/
+ public int getSize()
+ {
+ return indexedEdges.size();
+ }
+
+ /**
+ * {@inheritDoc}
+ */
public final Set<E> getEdges( V v )
{
return unmodifiableSet( adjacencyList.get( v ) );