I've a Boolean gene regulation system composed of vectors(corresponding to cellular phenotypes). Their components are binary numbers such as $\{1,0,0,1\}$. A vector can change its statement in timesteps. For example $\{1,0,0,1\} \longrightarrow \{1,1,0,0\} \longrightarrow \{0,0,1,0\}$, etc.

I know there are several programs doing that but can I draw a vector flow diagram in Mathematica? I mean every vector will correspond to a node(or point) and go to one another. If

$\{1,0,0,1\} = a, \{1,1,0,0\} = b, \{0,0,1,0\} = c$, where $a,b,c$ are constants,

then we have $a \longrightarrow b \longrightarrow c$.

The way above is just what i thought. Maybe there are more efficient ones.

Here is a link of the article containing what I exactly want Figure 2


I think this code answers the question:

data = RandomInteger[{0, 1}, {120, 4}];

edges = DirectedEdge @@@ Partition[data, 2, 1];

Graph[edges, VertexLabels -> "Name"]

enter image description here


Because of a question in a comment here is some code that shows the derivation of graphs, spanning trees of those graphs, their disjoint union, and a highlighted connecting path between them. I used disjoint union for clarity (with those random data graphs) -- regular graph union is probably desired with the actual data.

{data1, data2, data3} = 
  Table[RandomInteger[{0, 1}, {n, 4}], {n, {120, 80, 70}}];
{gr1, gr2, gr3} = 
 Map[Graph[DirectedEdge @@@ Partition[#, 2, 1]] &, {data1, data2, 

enter image description here

{tr1, tr2, tr3} = Map[FindSpanningTree[#] &, {gr1, gr2, gr3}]

enter image description here

gr = GraphDisjointUnion[tr1, tr2, tr3, VertexLabels -> "Name"];
connectingEdges = 
  DirectedEdge @@@ 
      Prepend[Length[VertexList[#]] & /@ {gr1, gr2, gr3}, 1]]], 2, 
HighlightGraph[EdgeAdd[gr, connectingEdges], connectingEdges]

enter image description here

| improve this answer | |
  • $\begingroup$ Thank you very much for your quick answer. One more thing, if I have 3 datasets like data1, data2, data3 can I make a tree plot both contain the three data flow(flow scheme)? It will have intersections(overlaps) between datasets. Please have a look at the figure 2 in the article I mentioned. $\endgroup$ – Haliki Apr 22 '16 at 13:19
  • $\begingroup$ @Haliki I looked into Figure 2 of the linked article. I don't have time to read the article in order to understand how that figure is derived. Please see my question update. $\endgroup$ – Anton Antonov Apr 22 '16 at 14:12
  • $\begingroup$ I think GraphLayout -> "LayeredDigraphEmbedding" should select the proper root vertex for a directed tree. If not, it has ` "RootVertex"` suboption. $\endgroup$ – Szabolcs Apr 22 '16 at 14:23
  • $\begingroup$ Thank you so much for your attention. That worked for me. Best regards. $\endgroup$ – Haliki Apr 25 '16 at 8:40
  • $\begingroup$ @Haliki Great! I am glad it is working out. $\endgroup$ – Anton Antonov Apr 25 '16 at 13:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.