Questions tagged [digraphs]

A 'digraph' means 'one symbol written as two characters'. In printing it meant two letters cast as one piece of lead, e.g. ae, fi, ...

digraphs
Filter by
Sorted by
Tagged with
4 votes
2 answers
5k views

Inserting unicode characters in vim

I would like a quick and easy way to insert certain unicode characters into text files with vim that I use often, for example, the British Pound Sterling and the tick characters instead of typing: i ...
Tony Barganski's user avatar
0 votes
1 answer
800 views

How to show k-partite graph in NetworkX?

I am currently looking for a solution to create a k-partite graph with Networkx. I have already implemented the bipartite graph and the image is attached As one can see due to connection among nodes ...
user3050590's user avatar
  • 1,696
1 vote
1 answer
324 views

Read digraph from a file

Hi all – I'm new to coding if anybody is wondering. This is my first time posting here and I'm currently stuck on one of my assignments. The code below is my draft code. The expected output for ...
icodealittle's user avatar
0 votes
1 answer
3k views

digraph object has no attribute 'add_path'

Scikit fuzzy rule formation cannot be done due to this error. Skfuzzy code and error message is shown below import matplotlib.pyplot as pit import skfuzzy as fuz import numpy as np from ...
Vivek Vijayan's user avatar
0 votes
1 answer
249 views

Proof that you can turn a connected graph into a strongly connected digraph by turning every edge into an arch?

We consider the street network of a given city which is connected - from every junction we can reach every other junction in the city (every street is a two-way street). (a) The city hall wants to ...
robbyyt's user avatar
1 vote
1 answer
180 views

Extract branches from digraph in MATLAB

I am looking for a way to extract the branches of a digraph in MATLAB. Precisely, if I have a network (my_digraph) similar to the following: When I enter my_digraph.plot I recieve this: I could now ...
00koeffers's user avatar
2 votes
1 answer
2k views

How to find the connected component containing max number of given set of nodes

I have a graph containing many genes and their interactions. I am interested in finding a subgraph with the maximum no .of a specific set of genes say, A, B, C, D, E in the graph. Tried BFS ...
yathrakaaran's user avatar
0 votes
0 answers
96 views

Converting List of words to Problem Graph For Minimum Spanning Tree Algorithm

I have been trying to construct a problem weighted Graph for Minimum Spanning Tree from a list or string of words as, given a string of words to list of named-tuple with every possible combinations of ...
Asiis Pradhan's user avatar
5 votes
5 answers
3k views

DiGraph parallel ordering

I have this kind of Directed Acyclic Graph with multiple roots: And I need to get a list with nodes sorted by directions and grouped by steps, like this: ordering = [ [1, 3], [2], [4], ...
Taras Protsenko's user avatar
1 vote
1 answer
3k views

How to draw a DiGraph in a Org Chart fashion?

issue statement: While I managed to get a chart out of a Networkx DiGraph via Matplotlib, I wish I could get better settings or be advised a more suitable library to draw it in a more 'readable' ...
ionah's user avatar
  • 81
0 votes
0 answers
447 views

Graphviz not displaying PNG in Python Idle

I am using the following code to display in image in Python IDLE but no luck. import pydot import graphviz import os G = pydot.Dot(graph_type = 'digraph') node = pydot.Node('Name') G.add_node(node) ...
Hasham Beyg's user avatar
0 votes
1 answer
575 views

write and read Graph, multiGraph, Digraph, MultiDigraph

Read and Write, Multigraph, MultiDiGraph ? I'm working with networkx and osmnx, And I wanted to know if there is any way to write and read a Multigraph and MultiDigraph.
harry's user avatar
  • 31
1 vote
0 answers
39 views

find patterns in digraphs

I'm trying to write simple code in java to find patterns (understood as recurrent sequence of elements in a superstructure) in digraphs (DAG) random generated. I know for example the K-recurring ...
Meda 's user avatar
  • 31
4 votes
2 answers
136 views

Label an edge with number of cycles it participates in

Given a graph G = (V, E), using DFS, how do I label each edge with the number of simple cycles it participates in? I am already labeling the nodes with a post-order when I extract the strongly ...
Aidenhjj's user avatar
  • 1,289
2 votes
1 answer
185 views

Find root of tree in Erlang / Elixir digraph

I have the following super simple digraph tree (code is Elixir): digraph = :digraph.new() coords = [{0.0, 0.0}, {1.0, 0.0}, {1.0, 1.0}] [v0, v1, v2] = (for c <- coords, do: :digraph.add_vertex(...
Thomas Browne's user avatar
1 vote
1 answer
1k views

Python NetworkX - get DiGraph from nested dictionaries

I am trying to create a simple DiGraph in python's NetworkX from nested dictionary but it looks like built in initialization doesn't built final leaf nodes. Toy example: class_hierarchy= {-1: ["A&...
Maksim Khaitovich's user avatar
3 votes
1 answer
864 views

Construct networkx Graph from .p (picked) file

I have been doing Datacamp course called Intro to network analysis (Pt1) and there is a test network in a form of Graph/DiGraph. In an interactive python shell on their website I can type T.edges(), ...
sharkzeeh's user avatar
0 votes
1 answer
367 views

How to show edge labes on DiGraph draw_networkx

I have nx.DiGraph like this (toy example) import networkx as nx G = nx.DiGraph() G.add_node('a', weight= 1) G.add_node('b', weight= 2) G.add_node('c', weight= 3) G.add_edge('a', 'b', range = 10) G....
Edward's user avatar
  • 4,553
-1 votes
2 answers
71 views

Which algorithm do I need for this directed graph operation?

I may be overthinking this and be missing something obvious, but I was wondering which NetworkX algorithm I could use to achieve the following: Given a DiGraph such as: And a list of nodes such as: ...
Sam Kennedy's user avatar
1 vote
0 answers
201 views

How to assign Network information to DiagrammeR grViz using vector

I have an adjacency matrix and want to use DiagrammeR Graphviz language to create a digraph of it. Bellow is my adjacency matrix MM MM<-matrix(c(1,1,0,0,0,1,1,1,1,0,0,1,1,1,0,0,1,0,1,1,0,0,0,1,1),...
Daniel Pardejo's user avatar
0 votes
1 answer
34 views

Manipulating edge-costs of a negatively weighted digraph to allow use of Dijkstra's algorithm

Suppose we have a digraph containing both positively and negatively weighted edges. I understand that the shortest-path solution is the Bellman-Ford algorithm. My question is: why can we not just ...
Dylan Fouche's user avatar
-1 votes
1 answer
706 views

Finding girth using BFS for a Digraph

So I am having some trouble finding the girth for the following Digraph. I am required to use BFS to find the girth, but I am lost in how to find it. Any help in this regard would be highly ...
User426190's user avatar
1 vote
1 answer
5k views

Graph implementation using python adding an edge

The teststring represents the structure given in euler project problem 18. Trying to solve it using graph theory. The graph structure I am trying to create is as below. Every number given in the ...
rainu's user avatar
  • 733
1 vote
1 answer
578 views

vim - search for a digraph using its octal value

If I have this digraph character: ň in a file, place the cursor over it and type ga I see the message <&#328;> 328, Hex 0148, Octal 510 But then if I search for /\%o510 or /%x0148 I ...
user364902's user avatar
  • 3,246
1 vote
1 answer
2k views

Networkx: How to iterate on ALL edges of a DiGraph, in a breadth-first manner?

I have a networkx DiGraph (not necessarily acyclic). All nodes have a common predecessor : the source node 0. I want to be able to edit the attributes of all edges, in a breadth first order. To do so,...
Clément F's user avatar
  • 3,765
0 votes
1 answer
92 views

Matrix multiplication MATLAB

So maybe I am overthinking this and making a mess of it.... I have a digraph in MATLAB. I need to change it to a undirected graph to evaluate it with minimum spanning tree (right? It won't work on ...
jdbul33's user avatar
  • 185
0 votes
1 answer
201 views

How to remove digraph highlighting in vim

Using vim or nvim, when I open a new vim terminal digraphs display correctly. See below: However, whenever I change colorscheme (any, it is not specific to a particular colorscheme) - then the ...
arcseldon's user avatar
  • 36.2k
4 votes
1 answer
4k views

Is it possible to change node size of a pydot graph?

I wrote a code to convert my MultiDiGraph() to a pydot graph to display self loops and arrows but after conversion, the pydot graph A has lost all the attributes of G. How can change the node size of ...
Silvi Mantri's user avatar
4 votes
1 answer
702 views

Generate all unique directed graphs with 2 inputs to each node

I'm trying to generate all unique digraphs that fit a spec: each node must have exactly 2 inputs and are allowed arbitrarily many outputs to other nodes in the graph My current solution is slow. Eg ...
Josh.F's user avatar
  • 3,736
0 votes
1 answer
229 views

NetworkX MultiDiGraph -- `id` and `key` appearing in edge data attributes?

I'm iterating over edges in a NetworkX MultiDiGraph like so: for u, v, k, d in g.edges(keys=True, data=True): ... In some instances, I find id and key keys in the dictionary d, but I can't ...
Matthew's user avatar
  • 1,376
4 votes
1 answer
1k views

Graphviz how to control the edges

screenshot. I am looking for a graph on the right but what I am getting is a graph on the left. I am new to Graphviz. I also had to make the nodes 1 and 2 just because I was not able to imitate the ...
Erwin Smith's user avatar
1 vote
1 answer
982 views

Netlogo: Creating links to new neighbors

I try to generate a directed graph in Netlogo. There should only be one link between two nodes. I use the following code fragment: breed [nodes node] directed-link-breed [edges edge] . . . ask ...
Eric's user avatar
  • 173
1 vote
2 answers
398 views

Python: how to get rid of non-ascii characters being read from a file

I am processing, with python, a long list of data that looks like this The digraphs are probably due to encoding problems. (I am not sure whether these characters will be preserved in this site) 29/...
Violapterin's user avatar
1 vote
0 answers
632 views

graphviz + Python: How to assign node position?

I have the following dictionary with edges as keys and floats as values. edges = {(24, 26): 0.513, (24, 27): 0.185, (25, 26): 0.205, (25, 27): 0.096, (26, 29): 0.561, (26, 30): 0.158, (27, 29): 0.217,...
YamiOmar88's user avatar
  • 1,386
0 votes
1 answer
2k views

Very Slow network graph animation in Python's matplotlib with networkx

I am tyring to animate a networkx graph growing over time. I have it working with curved edges and all. Quite pleased, BUT as the graph grows it slows down Considerably !? Can anyone explain or alter ...
Ram's user avatar
  • 158
0 votes
0 answers
111 views

Networkx - outdegree calculation

I'm calculating the outdegree over a series of different graphs. However, the last 'levels' in the graphs always produce a 0 outdegree when they shouldn't. For example, in the picture below the ...
jj8989's user avatar
  • 1
0 votes
2 answers
115 views

Why does a newline digraph in a macro get interpreted as a `j` in Vim?

Let's say I create a macro that goes down one line. qajq Register a contains exactly qajq, and so @a moves me down one line. Now let's say I type j into my buffer and yank it into register a using "...
pushkin's user avatar
  • 9,918
0 votes
1 answer
1k views

graphviz change orientation of a specific shape in a digraph

How can i place all "parallelogram" [see my code] on the top of the S boxes with graphviz dot langage? So basically the output should look like a straight line with all M1 M2 and Mn on the top of the ...
S12000's user avatar
  • 3,346
1 vote
0 answers
1k views

Computing indegree and outdegree of a digraph

first and foremost, I'm on a mobile device so this might not look pretty as the typical editing options are not available. I'm a bit confused on how to carry out finding the indegree and outdegree. ...
Al-geBra's user avatar
  • 179
1 vote
1 answer
2k views

Failing to read from edge list in networkx

Computing the shortest path seems to not work with me: import networkx as nx G = nx.read_edgelist(filename, delimiter=",", create_using=nx.DiGraph(), nodetype=int) print G print nx.shortest_path(G, ...
Bob's user avatar
  • 869
0 votes
1 answer
218 views

How can I access to adjacency lists inside the Vertex object?

I built a graph in Python, based on Vertex and graph classes, but in isCycleUtil() method, when I try to access Vertex object by doing for i in self.vert_dict[v], I get a TypeError: Vertex object not ...
IdelHamza's user avatar
1 vote
1 answer
482 views

Pandas DataFrame with levels of graph nodes and edges to square matrix

My Googlefu has failed me! I have a Pandas DataFrame of the form: Level 1 Level 2 Level 3 Level 4 ------------------------------------- A B C NaN A B D ...
codemaniac's user avatar
-1 votes
1 answer
204 views

How to access nodes edges of dot format graph (Generalised ) in haskell

I want to access the nodes, edges and properties of 'xDotGraph' (G.DotGraph) and set those again. Here is Haskell code that prints dot format graph using graphviz: $ cat example.dot digraph { ...
David's user avatar
  • 63
1 vote
1 answer
2k views

Number of Nodes in a Cycle of a graph

I am trying to find the number of nodes in a cycle of a graph. I am using recursion and DFS to calculate the number of nodes in all the cycles of the graph.Here is the calculating function in C++. ...
soumya dubey's user avatar
2 votes
1 answer
178 views

Finding a cycle or loop after digraph_utils:is_acyclic/1 returns false

How can I (efficiently) find a cycle or a loop in an Erlang digraph after digraph_utils:is_acyclic/1 returns false? EDIT: is_acyclic is defined as loop_vertices(G) =:= [] andalso topsort(G) =/= ...
Filip Haglund's user avatar
1 vote
0 answers
206 views

Shortest Path With Limitations on Node Visitation

I have a variant on the classic 'shortest path' problem and I don't know how to approach it. My graph topology is as such: There is one source and one sink. Other nodes are designated by a letter ...
Ralph's user avatar
  • 265
0 votes
2 answers
91 views

How do I constrain connected vertices to share a single edge?

Because of the way that information is being generated, I results that look like this: digraph "A" { "a1" -> "a2"; "a2" -> "a1"; "a1&...
Trevor Hickey's user avatar
-3 votes
1 answer
574 views

Dijkstra's Shortest Path with Strongly Connected Graphs

Assuming I have a working dijkstra's shortest path method, how can I use this to determine whether or not a directed graph is strongly connected or not?
Michael Schmidt's user avatar
18 votes
1 answer
2k views

What do <: and :> mean when declaring a lambda? [duplicate]

I have stumbled across following lambda syntax, which I do not understand: #include <iostream> template<typename Callback> void do_it(Callback callback) { callback(); } template&...
aadam's user avatar
  • 713
0 votes
1 answer
492 views

How to use non-positive integer as numeric node ID in digraph function?

For digraph, I want to use non-positive integer as numeric node ID. e.g; A = [-1 1 3]; B = [ 3 2 0]; plot(addedge(digraph, A , B)) If I run this, I receive this: Error using digraph/addedge>...
Sardar Usama's user avatar
  • 19.6k