Edges represent the logical connection between two regions in an entity. In the case of graphs, edges refer to the logical connection between two vertices, or nodes. Use this tag whenever you have a question about working with or traversing edges in a graph or a graph-based database. See also [edge-list].
Questions tagged [edges]
582 questions
11
votes
3 answers
NetworkX: how to add weights to an existing G.edges()?
Given any graph G created in NetworkX, I want to be able to assign some weights to G.edges() after the graph is created. The graphs involved are grids, erdos-reyni, barabasi-albert, and so forth.
Given my G.edges():
[(0, 1), (0, 10), (1, 11), (1,…

FaCoffee
- 7,609
- 28
- 99
- 174
11
votes
1 answer
How to put labels on the edges in the Dendrogram example?
Given a tree diagram like the Dendrogram example (source), how would one put labels on the edges? The JavaScript code to draw the edges looks like the next lines:
var link = vis.selectAll("path.link")
.data(cluster.links(nodes))
…

Will Ware
- 475
- 5
- 17
10
votes
2 answers
How to get the vertices from an edge using igraph in python?
I am looping through the edges of a graph with:
for es in graph.es:
....
# v = []
# v = es.vertices()?
...
What method can I use to get the source and the target vertices for each edge?

giorgioca
- 713
- 1
- 8
- 21
9
votes
2 answers
Python Networkx : find all edges for a given path in a multiDiGraph
In my multi directed graph, I would like to find all the (simple) paths possible between 2 nodes. I manage to get all the path, but cannot distinguish which edge (given that it's a multiDiGraph) the source node takes to reach the target node.
For…

filipyoo
- 347
- 1
- 7
- 15
8
votes
2 answers
graphviz: direction of edges in terms of color
Hi
Can I get graphviz to color the edges in a way that identifies the direction? For example, the part of the edge near its source node might be blue and then it gradually shades away to red as it nears the target node. Or are there any other…

Puneet
- 193
- 1
- 2
- 7
8
votes
1 answer
How to check if an edge has an attribute in Networkx
I created a graph in yEd and I want to check if an edge has an attribute. For example some edges have a label but some dont. When I try to do this I get an an error:
for n, nbrs in G.adjacency_iter():
for nbr,eattr in nbrs.items():
evpn =…

geolykos
- 383
- 1
- 5
- 15
8
votes
3 answers
Check if two vertices are connected in iGraph
Is there a very short expression in iGraph 0.6 for python 2.7 to see if two vertices specified by index are connected by an edge or not?
I found somewhere:
are_connected(v1, v2)
but in python I would get an error message: "NameError: global name…

Laci
- 566
- 2
- 15
- 39
8
votes
1 answer
Jung coloring vertex with value
I'm stuck at the moment with the Java library Jung.
I display vertices and edges, only I can not find any functions for vertex coloring that I need with the value of the vertices and not with the mouse.
import…

Daleksek
- 135
- 2
- 10
7
votes
1 answer
Boost Graph Library: edge insertion slow for large graph
I'm trying to use implement an "intelligent scissor" for an interactive image segmentation. Therefore, I have to create a directed graph from an image where each vertex represents a single pixel. Each vertex is then conntected to each of its…

Netztroll
- 73
- 1
- 4
7
votes
2 answers
What does boost::out_edges( v, g ) in Boost.Graph do?
I am not able to comprehend the documentation for this function, I have seen several times the following
tie (ei,ei_end) = out_edges(*(vi+a),g);
**g**<-graph
**vi**<-beginning vertex of graph
**a**<- a node
**ei and ei_end** <- edge iterators
What…

LoveMeow
- 3,858
- 9
- 44
- 66
7
votes
4 answers
Gremlin: How do you find vertices without a particular edge?
I've been looking at the Gremlin graph language, and it appears very powerful. However, whilst running through what it can do to evaluate it against requirements, I came across a case that I can't seem to complete.
Assuming Gremlin is started, and…

Jeroen van den Oever
- 73
- 1
- 1
- 6
6
votes
3 answers
R: K Means Clustering vs Community Detection Algorithms (Weighted Correlation Network) - Have I overcomplicated this question?
I have data that looks like this: https://i.stack.imgur.com/HmpRl.jpg
The first dataset is a standard format dataset which contains a list of people and their financial properties.
The second dataset contains "relationships" between these people -…

stats_noob
- 5,401
- 4
- 27
- 83
6
votes
2 answers
How to draw parallel edges in Networkx / Graphviz
I am trying to add parallel edges between two nodes using NetworkX but it fails with the below error. What am I doing wrong?
import networkx as nx
import graphviz
g1 = nx.MultiGraph()
node1 = 'a'
node2 =…

TraderMoe
- 93
- 1
- 8
6
votes
1 answer
R and igraph: subgraph nodes based on attributes of other nodes that are incident on edge
I have collaboration data of inventors on patents. Each inventor is a node, each edge represents a patent on which two inventors have collaborated. Some patents have >2 inventors, so some patents are represented with multiple edges.
I want to…

wake_wake
- 1,332
- 2
- 19
- 46
6
votes
3 answers
Algorithm to cover all edges given starting node
Working on an algorithm for a game I am developing with a friend and we got stuck. Currently, we have a cyclic undirected graph, and we are trying to find the quickest path from starting node S that covers every edge. We are not looking for a tour…

nequin
- 75
- 1
- 5