edges

The edges printed does not match the nodes

心不动则不痛 提交于 2020-01-15 11:28:25
问题 I have a program that reads a file with two columns of numbers, sorts them, creates three tables, one with only the nodes (individually), one with all the edges and one that has the amount of edges for every node. The problem is that when I try to print the edges, it prints them wrong or it says it cannot find them. Through some gdb I found out that the first arrays are fine but the third stores a bunch of random numbers (or zeros) through the end. Any help would be appreciated. The file

Jung coloring vertex with value

余生颓废 提交于 2020-01-13 08:39:34
问题 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 edu.uci.ics.jung.algorithms.layout.FRLayout; import edu.uci.ics.jung.algorithms.layout.Layout; import edu.uci.ics.jung.graph.Graph; import edu.uci.ics.jung.visualization.BasicVisualizationServer; import edu.uci.ics.jung.visualization.decorators.PickableVertexPaintTransformer; import edu

Is it possible to have several edge weight property maps for one graph?

你离开我真会死。 提交于 2019-12-29 08:15:25
问题 How would I create a graph, such that the property map (weight of edges) is different in each property map? Is it possible to create such a property map? Like an array of property maps? I have not seen anyone on the Internet using it, could I have an example? Graph g(10); // graph with 10 nodes cin>>a>>b>>weight1>>weight2>>weight3>>weight4; and put each weight in a property map. 回答1: You can compose a property map in various ways. The simplest approach would seem something like: Using C++11

Adding a legend in visNetwork for edge color

独自空忆成欢 提交于 2019-12-25 16:42:48
问题 I am using visNetwork to visualize a graph, but I need to introduce a legend based on the edge color. edge color is dependent on an edge attribute and its dynamic in nature. I tried to do with visGroups/visLegend, but got multiple errors. PFB reproducible example. library(igraph) library(visNetwork) gg <- graph.atlas(711) V(gg)$name=1:7 gg=set_edge_attr(gg,"Department",E(gg)[1:10],c("A","B","C","A","E","C","G","B","C","A")) E(gg)$label=E(gg)$Department F2 <- colorRampPalette(c("red", "blue",

How to change arrows in vis.js to chicken feet or cardinality

◇◆丶佛笑我妖孽 提交于 2019-12-24 16:25:41
问题 I am trying to use vis.js to show the structure of an XML or JSON Schema. I would like to show cardinality instead of an arrow. Any suggestions on documentation to view, because I cannot find any. Thanks, Loren 回答1: Each edge has a function that is responsible for drawing arrows: drawArrows . Accordingly, it is possible to redefine its: edge.drawArrows = function drawArrows(ctx, arrowData) { if (this.options.arrows.from.enabled === true) { drawArrowCircle(ctx, this.selected, this.hover,

Edges of the graph

寵の児 提交于 2019-12-24 11:25:09
问题 In order to find the kind of the edges of a graph, at which we applied the Depth-first search algorithm, we could use this: tree edges: x -> y when [d[y],f[y]] ⊂ [d[x],f[x]] forward edges: x -> y when [d[x],f[x]] ⊂ [d[y],f[y]] back edges: x -> y when [d[y],f[y]] ⊂ [d[x],f[x]] Cross edges: x -> y when [d[x],f[x]] ∩ [d[y],f[y]]=∅ Discovery Time : The discovery time d[v] is the number of nodes discovered or finished before first seeing v. Finishing Time : The finishing time f[v] is the number of

Find border (boundary) edges of planar graph (geometric shape)

一个人想着一个人 提交于 2019-12-24 02:03:24
问题 I have vertices and an edge list that describe a planar geometric shape (faces are triangles). For example: a_______b /|\ / / | \ / e/__|__\/c d Verts: a, b, c, d, e Edges: (a,b), (a,c), (a,d), (a,e), (b,c), (c,d), (d,e) So that is all the information I would have about that particular planar geometric shape. In this example, the only internal edges are (a,c) and (a,d). All other edges are border edges. How can I identify those border edges algorithmically (or conversely identify all internal

Creating a graph with edges of different colours in Mathematica

这一生的挚爱 提交于 2019-12-23 10:26:32
问题 I want to create a graph (Graph Theory) where certain edges have a different colour to other edges, which would be used to highlight a path in the graph from one vertex to another. Here are some examples which have different coloured edges http://demonstrations.wolfram.com/AGraphTheoryInterpretationOfTheSumOfTheFirstNIntegers/ and http://demonstrations.wolfram.com/Ramsey336/. I looked at source code for these but those solutions seem complicated. I need a simple example to work from. I reckon

Best Algorithm to find the edges (polygon) of vertices

半世苍凉 提交于 2019-12-21 05:11:19
问题 I have a large array of vertices, some of them are edges, some are redundant (inside the shape) and I want to remove those. The simplest algorithm I could think of is checking one by one if they hit the shape formed by the others. But it should be a very slow algorithm. I thought about picking one from the edge (the one farthest from origin per example) and calculate the longest path from this start... should get the edge path, right? Any suggestion? 回答1: The trick with polyhedral algorithms

Drawing multiple edges between two nodes with networkx

。_饼干妹妹 提交于 2019-12-21 04:19:11
问题 I need to draw a directed graph with more than one edge (with different weights) between two nodes. That is, I have nodes A and B and edges (A,B) with length=2 and (B,A) with length=3. I have tried both using G=nx.Digraph and G=nx.Multidigraph. When I draw it, I only get to view one edge and only one of the labels. Is there any way to do it? 回答1: Try the following: import networkx as nx import matplotlib.pyplot as plt G = nx.DiGraph() #or G = nx.MultiDiGraph() G.add_node('A') G.add_node('B')