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, ...

In graph theory, 'digraph' is an abbreviation of 'directed graph'. You may want to use the more explicit tag directed-graph.

In computer programming, digraphs and trigraphs are sequences of two and three characters respectively, appearing in source code, which a programming language specification requires an implementation of that language to treat as if they were one other character.

Various reasons exist for using digraphs and trigraphs: keyboards may not have keys to cover the entire character set of the language, input of special characters may be difficult, text editors may reserve some characters for special use and so on. Trigraphs might also be used for some EBCDIC code pages that lack characters such as { and }.

155 questions
1
vote
0 answers

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), 5, byrow=T) colnames(MM)<-c("A", "B", "C", "D",…
1
vote
1 answer

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 string is a node in the graph. 3->(7,4) …
rainu
  • 733
  • 2
  • 12
  • 26
1
vote
1 answer

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, I would like to be able to iterate on ALL edges,…
Clément F
  • 3,535
  • 6
  • 18
  • 26
1
vote
1 answer

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 nodes [ create-edges-to ((other nodes) with [not…
Eric
  • 163
  • 10
1
vote
2 answers

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/07/2016 04:00:12 0.125143 Now, when I read…
Violapterin
  • 337
  • 2
  • 14
1
vote
0 answers

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, (27, 30): 0.064,` (29, 30): 0.761, (29, 33):…
YamiOmar88
  • 1,336
  • 1
  • 8
  • 20
1
vote
0 answers

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. This is supplied from Coursera. I'm aware that in…
Al-geBra
  • 169
  • 3
  • 13
1
vote
1 answer

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, 1, 5) The file I'm reading…
Bob
  • 849
  • 5
  • 14
  • 26
1
vote
1 answer

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 E A B D F G …
codemaniac
  • 879
  • 1
  • 11
  • 31
1
vote
1 answer

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++. int iscyclic(int node,bool visited[],bool…
soumya dubey
  • 63
  • 1
  • 1
  • 10
1
vote
0 answers

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 and subscript integer (e.g.,…
Ralph
  • 255
  • 2
  • 18
1
vote
1 answer

Match keys to values in dictionary in python

Say for example this is my dictionary: my_dict= {"0" : {"1","2","3"},"1":{"2"},"2":{"3"}} I want to pair these values and keys together in every instance. What would be the most efficient way to add each key, into the corresponding values key to…
jontycg
  • 327
  • 2
  • 16
1
vote
1 answer

Reach n-th successor of a vertex in a branch

I created a digraph using the jgrapht library. I use the successorListOf() method to access a vertex's successor, but I'd like to be able to reach the n-th successor of a given vertex (which are Point objects in my case). My digraph has two branches…
Graham Slick
  • 6,692
  • 9
  • 51
  • 87
1
vote
1 answer

Automatically create objects based on a list's elements

I created a digraph using jgrapht library, and my vertices are Point objects I created with this code: public static class Point { public int x; public int y; public Point(int x, int y) { this.x = x; this.y = y; } @Override …
Graham Slick
  • 6,692
  • 9
  • 51
  • 87
1
vote
2 answers

Return number of edges of each vertex in a digraph (jgrapht)

I have a digraph created using: public static DirectedGraph directedGraph = new DefaultDirectedGraph(DefaultEdge.class); void setup() { Point myPoint = new Point(x, y); Point myNextPoint = new…
Graham Slick
  • 6,692
  • 9
  • 51
  • 87