Avery Ching commented on GIRAPH-141:

We need to think about what changes need to be made to support this in the API 
not make things too complicated for our users.  Here are some APIs from 
BasicVertex and MutableVertex that could be affected.

     * Get the edge value associated with a target vertex id.
     * @param targetVertexId Target vertex id to check
     * @return the value of the edge to targetVertexId (or null if there
     *         is no edge to it)
    public abstract E getEdgeValue(I targetVertexId);

     * Does an edge with the target vertex id exist?
     * @param targetVertexId Target vertex id to check
     * @return true if there is an edge to the target
    public abstract boolean hasEdge(I targetVertexId);

     * Add an edge for this vertex (happens immediately)
     * @param targetVertexId target vertex
     * @param edgeValue value of the edge
     * @return Return true if succeeded, false otherwise
    public abstract boolean addEdge(I targetVertexId, E edgeValue);

     * Removes an edge for this vertex (happens immediately).
     * @param targetVertexId the target vertex id of the edge to be removed.
     * @return the value of the edge which was removed (or null if no
     *         edge existed to targetVertexId)
    public abstract E removeEdge(I targetVertexId);

I don't want to change these APIs for the single edge graph since I think it 
would complicate this.

Rather than change APIs or add APIs to the single edge vertex to support 
multiple edges, another way to do is to give users the choice between single 
edge graphs and multi-edge graph from the beginning.  We could have a separate 
BasicMultiVertex and MutableMultiVertex built specifically for multi-edge 
graphs.  This wouldn't cluster the API of single edge graphs.  I think I'm a 
bit more in favor of this type of approach due to the simpler API for each 
type.  Since we aren't very dependent on these APIs internally, it shouldn't be 
too hard for us to add.

> mulitgraph support in giraph
> ----------------------------
>                 Key: GIRAPH-141
>                 URL: https://issues.apache.org/jira/browse/GIRAPH-141
>             Project: Giraph
>          Issue Type: Improvement
>          Components: graph
>            Reporter: André Kelpe
> The current vertex API only supports simple graphs, meaning that there can 
> only ever be one edge between two vertices. Many graphs like the road network 
> are in fact multigraphs, where many edges can connect two vertices at the 
> same time.
> Support for this could be added by introducing an Iterator<EdgeWritable> 
> getEdgeValue() or a similar construct. Maybe introducing a slim object like a 
> Connector between the edge and the vertex is also a good idea, so that you 
> could do something like:
> {code} 
> for (final Connector<EdgeWritable, VertexWritable> conn: getEdgeValues(){
>      final EdgeWritable edge = conn.getEdge();
>      final VertexWritable otherVertex = conn.getOther();
>      doInterestingStuff(otherVertex);
>      doMoreInterestingStuff(edge);
> }
> {code} 

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to