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

learn more… | top users | synonyms (2)

9
votes
1answer
118 views

How to get control over DepthFirstScan?

Is there a way to conditionally take control the flow during a depth-first scan against a TreeGraph? I have a tree graph whose nodes are constructed as object, and there's a method ...
1
vote
1answer
65 views

Assigning Variables for Degree Distribution [closed]

So my code is divided into 3 different sections: 1) Calculating clustering coefficient, 2) Extracting degree distribution 3) Using the degree distribution to get the mean of 1000 networks. ...
1
vote
2answers
216 views

Swapping elements of list

Say I have a directed graph inputted in the following format in Mathematica: g = {{1, "a", 2}, {2, "b", 1}} I'd like to plot this graph using ...
0
votes
0answers
87 views

Any useful operations on LinkedIn data?

I have connected to LinkedIn using SocialMediaData, but the information seems to be limited to my connections and their IDs. How is this interesting? Is there a way to load a network using the ...
6
votes
2answers
216 views

How do I reorder vertices in a graph?

I have a directed acyclic graph $g$, and I'd like to re-order the vertices in this graph object such that when I call VertexList[myGraph] the vertices appear in ...
9
votes
3answers
273 views

Remove redundant dependencies from a directed acyclic graph

Given a directed acyclic graph, I want to remove all the edges $v_i \rightarrow v_j$ if $v_j$ is reachable from $v_i$ by some other path. Given the rich set of graph algorithms in Mathematica, what is ...
1
vote
1answer
95 views

Gradually coloring edges in terms of their vertices colors

In order to color Edges in a Graph after applying a function such as VertexDegree I did the ...
4
votes
2answers
108 views

BezierCurve in EdgeShapeFunction fails when used on multiedges graph

I would like to create a network graph with curved edges. To do this, I wrote this function: ...
7
votes
0answers
281 views

Generating all spanning trees in an undirected graph

I was wondering if there is explicit source code for generating all spanning trees on undirected graphs. I don’t need anything very fancy – perhaps Minty's algorithm or Gabow & Myers. I've only ...
6
votes
3answers
239 views

Flow in pipeline graph

I have pipeline directed graph which has one source and several sinks ...
4
votes
1answer
119 views

Compatibility issues for Combinatorica package

I am trying to use the Combinatorica package in a Mathematica version 9 in the following code : ...
9
votes
3answers
7k views

Finding all simple paths between two vertices in a graph

There are built-in methods to find a shortest path between two vertices in a graph, and the question on finding all shortest paths between two vertices has gathered quite a bit of attention. A path ...
8
votes
2answers
207 views

Organise a graph's vertices into levels

I would like to organise a graph's vertices in levels. Consider ...
3
votes
3answers
153 views

Product of edge weights in path

I need to calculate the product of graph edge weights on the path taking into account edge direction. I.e. for graph ...
6
votes
4answers
176 views

Draw graph wherein vertices are ArrayPlots

I need to place ArrayPlots in the vertices of graph. i.e. in graph Graph[{1->2, 2->3, 3->1}] I have to replace vertex 1 with ArrayPlots[{{0,0,1}}] and ...
1
vote
1answer
111 views

Problem with GlobalClusteringCoefficient

I have a simple problem, I would like to measure the global clustering coefficient for a random graph. Here is my code: ...
1
vote
2answers
237 views

Coloring vertices using GraphPlot

I have the following problem: I used GraphPlot to plot my adjacency matrix. I divided my nodes in three groups: ...
3
votes
1answer
160 views

Merging Vertices of a Graph and adding up the edges weights

I have a Weighted Graph of g which looks like this. ...
0
votes
1answer
56 views

Testing Equality Expression?

Even if in Graph[{1 -> 2}] == Graph[{1 \[DirectedEdge] 2}] the answer is True ; but why MMA doesn't show the result of the ...
1
vote
3answers
126 views
2
votes
1answer
103 views

Distances of locations in the matrix form

I want to have the distances of the cities in the matrix form.How can I have it for example for the cities like followings that also includes the distance of the city from itself which is zero: ...
4
votes
2answers
715 views

Finding face vertices from the face adjacency graph

I have a question about face adjacency graphs. Suppose that I have an adjacency matrix ...
3
votes
0answers
208 views
3
votes
2answers
186 views

How can I construct “better” block graphs?

A graph is a block graph if it can be constructed from an undirected tree by replacing each edge with a clique. My method of generating "random" block graphs is as follows. The parameters are the ...
7
votes
1answer
158 views

How to scale edge length and keep layout of edge-weighted Graph?

I love using Graph as structure to store and visualize my data in Mathematica. Consider the following simple example for creating a ...
0
votes
0answers
102 views

Pearl's Message Passing Algorithm

Has anyone tried to implement the Message Passing algorithm using Mathematica's Graph/Combinatorica features?
1
vote
1answer
144 views

Find size of vertex image relative to the graph coordinate system

I am trying to define a graph using my own VertexShapeFunction with an ActionMenu button being the vertex and a custom ...
5
votes
2answers
264 views

How to add new nodes to an existing graph with fixed (coordinates) nodes?

I'm ultimately trying to create a directed graph with some of the nodes in fixed positions and the other nodes placed around them in "acceptable" positions. It's better if I ask the question by ...
1
vote
1answer
88 views

FindEdgeCut with weighted graphs

If I want to find a minimum cut between two nodes in a weighted graph, I would use FindEdgeCut as follows: ...
0
votes
1answer
88 views

How can I replace UndirectedEdges to pairs of bi-directional DirectedEdge in a Graph?

How can I have pair of edges between nodes in this kind of graphs? ...
3
votes
1answer
152 views

Vertex Labeling Problem in a Graph

I am using following codes to create a graph. ...
10
votes
1answer
453 views

Roads network visualization by thickness and color intensity by population from GIS files

We can have road networks of the countries in GIS shape file.For exmple from here. Normally traffic flows are proportionate to populations of the cities. I wonder how we can have the same in ...
5
votes
1answer
67 views

Setting PropertyValue for VertexWeight is not persistent

g = CompleteGraph[8, VertexSize -> Medium]; PropertyValue[{g, VertexList[g][[1]]}, VertexWeight] = 10; PropertyValue[g, VertexWeight] ...
1
vote
1answer
89 views

Is there a TwoColoring function of Graph object?

The following code shows the GraphUtilities package makes a problem for Graph object. I want to use a ...
5
votes
1answer
405 views

All possible topological orderings of a graph

TopologicalSort[] returns one of many unique orderings. From wikipedia: if a topological sort does not form a Hamiltonian path, the DAG will have two or ...
9
votes
1answer
100 views

FindHamiltonianCycle is not invariant to edge permutation

Found this bug-like behaviour today: if the order of edges is changed so that VertexList does not return the vertices in canonical order, ...
3
votes
1answer
46 views

Problems with PropertyValue when Graph's vertices are Lists

I create a Graph which vertices are lists (points in n-dimensional space) ...
3
votes
1answer
138 views

How can I highlight and individually color the connected components of a graph?

I have a graph G, and I wish to individually highlight and color the different connected components of a graph. It is simple enough to do this for one component: ...
1
vote
1answer
142 views

Do any users know of methods to capture Twitter feeds and subject them to analysis? [duplicate]

I would like to use the output of about 300 Twitter sources and would probably collect 30 minutes of tweets at a time and subject each collection to analysis; ideally this process would be automatic ...
1
vote
2answers
101 views

Separating disconnected graph objects without losing vertex coordinate assignments

Say I have a graph Gtest, which has multiple disconnected components. I found that I can isolate individual components while retaining vertex coordinate ...
0
votes
1answer
32 views

Parsing output from FindHamiltonianCycle to recover an ordered list of vertex positions for a discovered path

After applying FindHamiltonianCycle to a graph, one generates output that looks like the following: ...
2
votes
1answer
162 views

Manipulate graphs in 3D

Is it possible to Manipulate Graphs (e.g. a ...
3
votes
1answer
96 views

LineGraph Labels

I have a graph with labels on the edges: ...
1
vote
2answers
348 views

How do I divide the columns of a matrix by the sum of its elements?

I am trying to create a transition matrix for a network. In order to do this, I need to sum down the column (the out degree), and then divide the column by the out degree in order to normalize it. ...
5
votes
1answer
126 views

Keeping vertexcoordinates after adding a new vertex

I want to add a new vertex to a graph, with fixed VertexCoordinates but when I use VertexAdd, the new graph does not have the VertexCoordinates of the previous one. ...
12
votes
4answers
903 views

Finding elementary cycles of (directed) graphs

I need to enumerate all the simple cycles (i.e. elementary cycles where no vertex is repeated other than the starting) of a graph which has both directed and undirected edges, where we can treat the ...
1
vote
2answers
281 views

EdgeRenderingFunction question

(Edit 1 : I added this paragraph after the original post, for context) Some context for this question can be found in another post (Problem with EdgeRenderingFunction), which however may be taken ...
5
votes
2answers
314 views

Sierpinski carpet with GraphData

Is this graph in the list among the so-called "standard" structures used in GraphData? However, I have not found, yet, anything like "Carpet" or "Sponge" in the ...
14
votes
3answers
878 views

Creating diagrams for category theory

Lately I've been doing algebra and I have found myself drawing a bunch of diagrams when I attempt to solve a problem. Most of the diagrams are very simple so I thought, I bet I can do this in ...
2
votes
4answers
368 views

Graph Creation in Mathematica: TSP

I'm trying to create the following graph in Mathematica Where do I start? I'm specifically trying to make a graph so that I can use it in TravelingSalesman[g], ...