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
5
votes
1 answer

Single colons in arbitrary expressions?

I need to figure out what this obfuscated C++ code (written by someone else) does. I've figured pretty much everything, except one tricky part: bool part1(char *flag) { int *t = (int *) memfrob(flag, 8); unsigned int b[] = {3164519328,…
LeKSuS
  • 91
  • 5
5
votes
5 answers

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], [5, 6], [7] ] Maybe there is some ready…
Taras Protsenko
  • 545
  • 1
  • 6
  • 15
4
votes
1 answer

multiple digraphs in vim

As you probably know, there is ability to enter some specific characters in vim using digraphs (In input mode Ctrl+K Rg produces ® for example). Is there a way, to define hotkey, to enter the mode which allows me to input multiple digraphs? For…
4
votes
2 answers

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 connected components from the graph, so maybe I can use…
Aidenhjj
  • 1,249
  • 1
  • 14
  • 27
4
votes
1 answer

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 graph A and set them equal to corresponding value…
Silvi Mantri
  • 41
  • 1
  • 3
4
votes
1 answer

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 for 6 nodes, the algo has taken 1.5 days to get…
Josh.F
  • 3,666
  • 2
  • 27
  • 37
4
votes
1 answer

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 image on the right. Also my shapes of terminals…
Erwin Smith
  • 761
  • 2
  • 6
  • 8
4
votes
2 answers

What is the best data structure and algorithm for comparing a list of strings?

I want to find the longest possible sequence of words that match the following rules: Each word can be used at most once All words are Strings Two strings sa and sb can be concatenated if the LAST two characters of sa matches the first two…
devoidfeast
  • 829
  • 3
  • 12
  • 22
4
votes
2 answers

Avoid creation of duplicate vertices in digraph (using jgrapht)

I am looking for a way to avoid creating duplicates in my digraph (I use the jgrapht library). I read some topics which said to use: directedGraph.setCloneable(false); But it doesn't seem to be right, can't find it in the library's documentation…
Graham Slick
  • 6,692
  • 9
  • 51
  • 87
4
votes
1 answer

Faster cycle detection in a Directed Acyclic Graph?

I have a program in Ruby 1.9.3 that constructs a RubyTree. My data is best described as being a Directed Acyclic Graph (DAG); please note that it is not a polytree. Well, at least the data should be a DAG, despite users' best efforts to foil my…
allquixotic
  • 1,481
  • 2
  • 18
  • 37
4
votes
1 answer

Graphviz Dot placing node inside subgraph even though it was defined elsewhere

I am trying to make a dot script generator for a homework problem, it's going well except I have this issue where some nodes that are not defined in subgraphs are being placed in them. For example the following dot script: digraph dg { …
agilesynapse
  • 41
  • 1
  • 5
4
votes
1 answer

GraphViz - How to make subgraph contain shape?

I have a graph that represents one large process made up of two smaller processes. Each of the smaller processes is represented by a subgraph. But when I connect the end of one of those subprocesses (let's say "one") to the start of the other…
Jeremy Thomerson
  • 722
  • 2
  • 8
  • 19
3
votes
1 answer

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(), T.nodes() etc. But I have no idea how to load the…
sharkzeeh
  • 59
  • 1
  • 4
3
votes
1 answer

Retrieve "n-1" and "n+1" element of each position in a for loop

I have a digraph (created using the jgrapht library) which takes as vertices Point objects. I add vertices and edges as a flood fill algorithm goes through a given matrix. I created it using this code: public static DirectedGraph
Graham Slick
  • 6,692
  • 9
  • 51
  • 87
2
votes
1 answer

How to enter digraph mode permanently in vim/neovim

I want to enter digraph mode Ctrl+k permanently, so that i can type multiple digraphs at once, forexample typing a sentence in greek letters. or typing multiple languages, like japanese, chinese, greek, etc. without changing input language. How can…
Hamza Zubair
  • 1,232
  • 13
  • 21
1
2
3
10 11