Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

Questions tagged [graphs-and-networks]

Questions about handling graphs in Mathematica, graph theory, graph visualization, GraphPlot, the built-in Graph type and the Combinatorica` package.

Filter by
Sorted by
Tagged with
3
votes
1answer
57 views

How do I color edges on a graph using a pattern?

I have the following code, an attempt to color the even branches of a tree... but it’s not working correctly: ...
0
votes
1answer
23 views

I am having trouble with the Show[] section of this code

Question: I am unsure how to graph the interpolated graph with the regular graph on the interval [1,4]. Not even the Show line works about im pretty sure its written correctly. Clear["Global`*"] f[...
3
votes
4answers
110 views

how to make tree plot to 100 rows

[ I know how to make finite tree plot(small row numbers), but how can I make this thing continue to 100 rows? Thank you very much!!
1
vote
1answer
28 views

Changing Vertex Color and Coordinates From a list or vertex

I'm making a visualisation of an email network of a company. Each vertex represents a person and vertex color represents their position(BOD,CEO,manager,leader). The edges' Thickness according to ...
2
votes
1answer
78 views

EdgeStyle in GraphPlot

I am trying to change the thickness of each edge according to its weight using GraphPlot but it doesnt seem to work. ...
2
votes
0answers
31 views

Generating a directed graph from a map of flows

I have generated a stream plot, with curves on it using the following code: ...
1
vote
0answers
59 views

Two graph specifications that I expect to produce identical graphs don't [closed]

I would like to add up the following two seemingly identical graphs, but it seems they are different. I can't figure out what is the difference between them and how to make them really identical <...
0
votes
0answers
36 views

An Elementary Introduction - Problem 22.13 VertexLabels [duplicate]

Problem 22.13 Make raster images of the letters of the alphabet at size 20, then make a graph of the 2 nearest neighbors of each one. My solution ...
1
vote
0answers
64 views

Graph of a list of rules with coefficient

I am trying to transform an expression to a list of rules and after that plot its graph. The expression has the following form ...
1
vote
1answer
78 views

How to construct a specific binary tree from a particular set of information?

I run a algorithm to solve a problem that return a set of information relative to a binary tree associated with these problem. For illustrate the results obtained I try to plot the binary tree. I make ...
4
votes
1answer
80 views

Algorithmic graph embedding (layout) based on the values of adjacent vertices

I would like to embed (layout) a tree graph where the angle of each edge is determined by a simple function of the values of the vertices that that edge joins as well as the previous edge angle. An ...
4
votes
0answers
62 views

Graph Partition

Consider a graph 'g': ...
1
vote
1answer
45 views

Splitting a weighted graph

Consider a weighted graph: ...
1
vote
1answer
62 views

Coloring ladder rung graphs

I can use various algorithms to list all proper $k$-colorings of the vertices of the ladder rung graph $nP_2$, the first six are show below. Is there a quick way in Mathematica to list all proper $k$-...
3
votes
2answers
86 views

Counting k-colorings of a graph

Combinatorica can list all $k$-colorings of the vertices of a graph $g$, which is a coloring of the vertices with no two colors adjacent, and using no more than $k$-colors: ...
5
votes
2answers
58 views

Color Specified Edges and Vertices

Is there a more efficient way to code the specifying of selected vertices and edges than listing them separately as shown below? ...
2
votes
1answer
79 views

Stacking and wiring 2 random graphs on top of each other

Suppose we have 2 random graphs, each spatially embedded in a square plane, and vertices connected according to a distance criterion (or different degrees of nearest neighbour). I am trying to figure ...
2
votes
2answers
63 views

Labeling Legs in a Loop on a graph

I am trying to make a graph with some loops such as this one, ...
1
vote
1answer
32 views

Checking if an edge is an element of a list of edges

I have graph whose edge list is given by ...
0
votes
0answers
23 views

Coloring individual edges of a multigraph each with its own color

Could someone tell me how to color two different edges between the same two vertices with a different color? The last time a related question was asked is 4 years ago, so I am wondering if the ...
8
votes
0answers
54 views

Probable bug in EdgeAdd when adding edges to multigraphs

Bug introduced in 10.0 or earlier and persisting through 12.0 M10.0.2 and M10.3 return a wrong result without errors. M11.0 and M12.0 issue a flood of messages and sometimes crash. I am using ...
1
vote
0answers
52 views

Understanding how ComponentMeasurements finds neighbors

I am trying to understand how the module ComponentMeasurements in Mathematica works when the property Neighbors is called in ...
1
vote
1answer
49 views

Combining two directed graphs without loosing any edge

I have two directed graphs given below: one={1 -> 2, 1 -> 3, 3 -> 4, 4 -> 1}; two={1 -> 2, 1 -> 3, 1 -> 4}; I simply want to map the two ...
4
votes
2answers
184 views

How to put the parent node higher than the children nodes in a drawing for a graph?

I have a tree as below. Graph[{7 -> 2, 2 -> 3, 3 -> 4, 3 -> 5}, VertexLabels -> "Name"] However, I want the drawing would put parent nodes at a ...
1
vote
2answers
69 views

Edge list of a graph as a simple list of lists of pairs of integers?

Suppose I have a list of graph edges in the form: e={UndirectedEdge[1,2], UndirectedEdge[3,4]} How can I convert this to a simple list of lists: ...
17
votes
2answers
1k views

Causal Diagrams using Wolfram?

How can one use Wolfram to make diagrams like with the arrows labeled as well (to label "mediating factors" between the causal elements)?
18
votes
2answers
530 views

Creating graph out of particles images

I have recently started learning how to use Mathematica's brilliant image processing tools, and the image I've taken as first example is the following (source): So far I've tried to first use ...
3
votes
1answer
87 views

Reverse graph generation

The more usual way of generating graphs and random graphs, is to start from a mechanism of adding nodes (e.g. randomly embedding or connecting, or randomly rewiring edges, etc), and for which we know ...
10
votes
3answers
1k views

Efficiently finding furthest two nodes in a graph

I am trying to learn how in an efficient way can one find the diameter of a random graph, that is, the longest shortest path, and its corresponding end-nodes. The direct built-in function ...
5
votes
3answers
191 views

Convert graph format for Mathematica graph functions

I have an output of many large graph files, specified by pair of vertices, in a format like ...
0
votes
0answers
35 views

High dimensional integral not evaluating? [duplicate]

I am trying to integrate as follows: ...
3
votes
0answers
60 views

Steiner Tree Approximation

I am wondering about the existence of Mathematica code to find (approximate) Steiner trees in graphs. I know there are a number of algorithms to do so --- just curious if anyone has implemented any ...
3
votes
1answer
82 views

How to plot connected components in the format of community structure plot?

I have the following code plotting community structure of random graph g. As one can see, the community structure plot presents ...
5
votes
1answer
118 views

Drawing finite-state automata without using VertexRenderingFunction

In the tutorial entitled "Hierarchical Drawing of Directed Graphs" in Mathematica 12, there is an example of how to draw a graph with several properties I want, but it uses an option called ...
3
votes
1answer
78 views

Edge weights in directed graphs

Apologies for what seems like a silly question. I'm sure I am missing something obvious, but this is driving me a bit crazy. Does EdgeWeight work differently in Directed vs. Undirected graphs? If I ...
1
vote
2answers
96 views

How to position vertices according to clustering coefficient in a nice way?

I have a graph and I want to rank each vertex according to its local clustering coefficient. I have done the following: ...
6
votes
0answers
77 views

Mathematica's algorithm for FindIndependentEdgeSet? [closed]

Documentation does not mention about algorithm. My guess is Blossom algorithm because I do not know of any better one. Posting it with hope that someone might know it for sure.
2
votes
2answers
73 views

Finding Non-Simple Paths of a Given Length on a Graph

For the following graph: ...
7
votes
2answers
143 views

How to get distinct labels on parallel edges in a graph?

The following doesn't display as you'd expect: Graph[{Labeled[1 -> 2, "A"], Labeled[1 -> 2, "B"]}, VertexLabels -> "Name"] The parallel edges are both ...
6
votes
2answers
116 views

Color Specified Vertices in LayeredGraphPlot

Can vertices S and R9 (for example) be fill colored (say red or black) in a LayeredGraphPlot? ...
0
votes
0answers
38 views

Function iteration

I wrote a function in Mathematica that applies certain construction steps on the "incidence matrix" of a graph in order to obtain a new graph with certain properties. These construction steps can be ...
0
votes
1answer
53 views

Forced colorings with IGraph/M

Is it possible to force the colors of certain vertices in a graph so that the function which finds a minimum coloring will then extend the partial coloring with the fewest possible number of extra ...
2
votes
2answers
55 views

No difference between TraditionalForm and StandardForm in Graph labels

TraditionalForm seems not to be working properly on Mathematica 11.3 when used in Graph. The following MWE ...
2
votes
0answers
35 views

The function VertexContract does not work in specific case

I am using the function VertexContract and I am experiencing that it does not work in some specific cases. If I give the graph with EdgeWeights, EdgeLabels and VertexLabels, I cannot contract {2,5} ...
3
votes
1answer
79 views

Generating all connected graphs from a set of n-valent vertices?

I would like to have a function generateConnected[list_] that, given a set of vertices with pre-defined valence (number of outgoing edges) generates all possible ...
9
votes
2answers
736 views

How can I get edges to bend to avoid crossing?

I want to generate a layered drawing of the Hoffman–Singlelton graph. As an example of what I want, here is a layered drawing of the Petersen graph: Now if I right click on the output of ...
1
vote
0answers
39 views

Alternatives for chromatic number in graphs

The function IGChromaticNumber in IGraph works great, so well, that I have been able to check the chromatic number of graphs with max degree 12 with over a thousand vertices in a relatively short ...
3
votes
1answer
187 views

Graphical representation of connection of people

I want to make a graphical representation of the people with the location, but coding is a little bit challenging. Here is my input {Person,Location,Influences} ...
1
vote
3answers
77 views

Generate a graph from function on the vertices

I have a concrete function $f:V\rightarrow P(V)$ that describes the neighborhood of a vertex $g$. I tried to use FunctionalGraph[f, V] , but apparently, this ...
1
vote
0answers
54 views

How can I parametrically generate a hierarchically clustered network? [closed]

I'm trying to create an image to illustrate what a large, hierarchically clustered network looks like. The details of the network don't matter, as long as, when plotted, it clearly shows at least a ...