# Visualized graph of trait/mutation dependencies

**URL:** <https://discourse.cataclysmdda.org/t/visualized-graph-of-trait-mutation-dependencies/2759>\
**Category:** The Bunker\
**Created:** [August 19, 2013, 7:38pm UTC](https://discourse.cataclysmdda.org/t/visualized-graph-of-trait-mutation-dependencies/2759 "2013-08-19T19:38:23Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![CIB](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/cib/32/903_2.png) [@CIB](https://discourse.cataclysmdda.org/u/CIB)\
**Post date:** [August 19, 2013, 7:38pm UTC](https://discourse.cataclysmdda.org/t/visualized-graph-of-trait-mutation-dependencies/2759/1 "2013-08-19T19:38:23Z")

</div>

I was bored… posting here since I can’t upload images to the wiki. =(

[![](http://i.imgur.com/1WR52ON.png)](http://i.imgur.com/1WR52ON.png)

Made with the following function, called from main.cpp:

```auto
void write_trait_dot() {
	std::ofstream fl;
	fl.open ("traits.dot");
	fl << "digraph traits {\n";
	for(int i=0; i<PF_MAX2; i++) {
		bool has_edge = false;
		
		mutation_branch& branch = g->mutation_data[i];
		if(branch.prereqs.size()) {
			has_edge = true;
		} else {
			for(int h=0; h<PF_MAX2; h++) {
				mutation_branch& branch2 = g->mutation_data[h];
				for(int j=0; j<branch2.prereqs.size(); j++) {
					if(branch2.prereqs[j] == i) {
						has_edge = true;
					}
				}
			}
		}
		if(has_edge) {
			fl << i << " [label=\"" << traits[i].name << "\"]\n";
		}
	}
	for(int i=0; i<PF_MAX2; i++) {
		mutation_branch& branch = g->mutation_data[i];
		for(int j=0; j<branch.prereqs.size(); j++) {
			fl << branch.prereqs[j] << "->" << i << " [label=\"\", fontcolor=darkgreen]\n";
		}
	}
	fl << "}";
	fl.close();
}
```

And then running dot over it:

```auto
dot -Tpng traits.dot > traits.png
```

---

<div class="post-metadata">

**Author:** ![PiotraperPL](https://avatars.discourse-cdn.com/v4/letter/p/6bbea6/32.png) [@PiotraperPL](https://discourse.cataclysmdda.org/u/PiotraperPL)\
**Post date:** [August 19, 2013, 8:39pm UTC](https://discourse.cataclysmdda.org/t/visualized-graph-of-trait-mutation-dependencies/2759/2 "2013-08-19T20:39:28Z")

</div>

I think I will color code this graph with , , and   
[hr][center]EDIT[/center][hr]  
Here it is, it will be useful to me, at least.

 ![](http://i.imgur.com/HJnuBt4.jpg)

---

<div class="post-metadata">

**Author:** ![Isidarth](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/isidarth/32/106_2.png) [@Isidarth](https://discourse.cataclysmdda.org/u/Isidarth)\
**Post date:** [August 20, 2013, 1:26am UTC](https://discourse.cataclysmdda.org/t/visualized-graph-of-trait-mutation-dependencies/2759/3 "2013-08-20T01:26:08Z")

</div>

I have a text file sitting on my desktop right now that basically does this, purely for curiosity and for art reasons.

The only thing I would note is that a few are listed as separate trees/paths when they cancel each other out. Like carnivore/herbivore, or pretty/ugly.

---

<div class="post-metadata">

**Author:** ![Inquisitor\_Dust](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/inquisitor_dust/32/119_2.png) [@Inquisitor\_Dust](https://discourse.cataclysmdda.org/u/Inquisitor_Dust)\
**Post date:** [August 20, 2013, 1:33am UTC](https://discourse.cataclysmdda.org/t/visualized-graph-of-trait-mutation-dependencies/2759/4 "2013-08-20T01:33:01Z")

</div>

[quote=“Isidarth, post:3, topic:2759”]I have a text file sitting on my desktop right now that basically does this, purely for curiosity and for art reasons.

The only thing I would note is that a few are listed as separate trees/paths when they cancel each other out. Like carnivore/herbivore, or pretty/ugly.[/quote]  
Maybe put a broken line in between the ones that cancel each other out?  
We should get this up on the wiki if we can find someone who can post images to do it.

---

<div class="post-metadata">

**Author:** ![utunnels](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/utunnels/32/81_2.png) [@utunnels](https://discourse.cataclysmdda.org/u/utunnels)\
**Post date:** [August 20, 2013, 1:37am UTC](https://discourse.cataclysmdda.org/t/visualized-graph-of-trait-mutation-dependencies/2759/5 "2013-08-20T01:37:41Z")

</div>

Those useless ones usually add ugliness so can be consider bad.

---

<div class="post-metadata">

**Author:** ![KA101](https://avatars.discourse-cdn.com/v4/letter/k/278dde/32.png) [@KA101](https://discourse.cataclysmdda.org/u/KA101)\
**Post date:** [August 20, 2013, 3:23am UTC](https://discourse.cataclysmdda.org/t/visualized-graph-of-trait-mutation-dependencies/2759/6 "2013-08-20T03:23:44Z")

</div>

Wiki was due for an update. Nice job.

Now if you’d run that script to sort out how many mutation categories each mutation occurs in, I’d appreciate that–would save me a lot of effort trying to count them all.

(Got a mutation-by-the-numbers post on the back burner because Day Job & Tedium.)

---

<div class="post-metadata">

**Author:** ![Zireael](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/zireael/32/956_2.png) [@Zireael](https://discourse.cataclysmdda.org/u/Zireael)\
**Post date:** [August 20, 2013, 7:04am UTC](https://discourse.cataclysmdda.org/t/visualized-graph-of-trait-mutation-dependencies/2759/7 "2013-08-20T07:04:15Z")

</div>

I love the graph, but a color code would be useful, too.

---

<div class="post-metadata">

**Author:** ![PiotraperPL](https://avatars.discourse-cdn.com/v4/letter/p/6bbea6/32.png) [@PiotraperPL](https://discourse.cataclysmdda.org/u/PiotraperPL)\
**Post date:** [August 20, 2013, 7:33am UTC](https://discourse.cataclysmdda.org/t/visualized-graph-of-trait-mutation-dependencies/2759/8 "2013-08-20T07:33:36Z")

</div>

> [@Zireael](#):
>
> I love the graph, but a color code would be useful, too.

[quote=“PiotraperPL, post:2, topic:2759”]I think I will color code this graph with , , and   
[hr][center]EDIT[/center][hr]  
Here it is, it will be useful to me, at least.

![](http://i.imgur.com/HJnuBt4.jpg)

---

<div class="post-metadata">

**Author:** ![CIB](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/cib/32/903_2.png) [@CIB](https://discourse.cataclysmdda.org/u/CIB)\
**Post date:** [August 20, 2013, 7:48am UTC](https://discourse.cataclysmdda.org/t/visualized-graph-of-trait-mutation-dependencies/2759/9 "2013-08-20T07:48:20Z")

</div>

Just give me an algorithm to calculate the color of a node. 😉 I could also add conflicts, but not sure how. As edges? Then the graph would become insanely complex and huge.

---

<div class="post-metadata">

**Author:** ![Isidarth](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/isidarth/32/106_2.png) [@Isidarth](https://discourse.cataclysmdda.org/u/Isidarth)\
**Post date:** [August 20, 2013, 1:01pm UTC](https://discourse.cataclysmdda.org/t/visualized-graph-of-trait-mutation-dependencies/2759/10 "2013-08-20T13:01:02Z")

</div>

If there was a way to make a tree go two ways, like: Saprovore\<Carnivore \<-\> Herbivore \> Ruminant, that might work. Else have a generic term like “eating habits” that then branches like the other multipath traits. Perhaps a special color for “standard” or “human” traits, so people don’t get confused when they see the trait “Omnivore.”

If I were a code wizard I would try to whip something up; unfortunately, that term only has meaning to me as a dude named Alexander who has some sweet beats.

---

<div class="post-metadata">

**Author:** ![Zireael](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/zireael/32/956_2.png) [@Zireael](https://discourse.cataclysmdda.org/u/Zireael)\
**Post date:** [August 20, 2013, 1:26pm UTC](https://discourse.cataclysmdda.org/t/visualized-graph-of-trait-mutation-dependencies/2759/11 "2013-08-20T13:26:40Z")

</div>

Thanks for the colored graph, Piotr.

Any chance of getting this up on the wiki ASAP? I would do it, but forgot how to upload images to the wiki. ☹

---

<div class="post-metadata">

**Author:** ![youtoo](https://avatars.discourse-cdn.com/v4/letter/y/779978/32.png) [@youtoo](https://discourse.cataclysmdda.org/u/youtoo)\
**Post date:** [August 20, 2013, 2:41pm UTC](https://discourse.cataclysmdda.org/t/visualized-graph-of-trait-mutation-dependencies/2759/12 "2013-08-20T14:41:50Z")

</div>

i have no tested the mutation items that go to specific types of mutations. I have been sticking to the generic ones since I get 3 per mutation. I use robust genetics. i may test out specific ones just to see if im more likely to get good ones even if you get less.

---

<div class="post-metadata">

**Author:** ![i2amroy](https://sea2.discourse-cdn.com/flex016/user_avatar/discourse.cataclysmdda.org/i2amroy/32/909_2.png) [@i2amroy](https://discourse.cataclysmdda.org/u/i2amroy)\
**Post date:** [August 21, 2013, 7:04pm UTC](https://discourse.cataclysmdda.org/t/visualized-graph-of-trait-mutation-dependencies/2759/13 "2013-08-21T19:04:18Z")

</div>

> [@youtoo](#):
>
> i have no tested the mutation items that go to specific types of mutations. I have been sticking to the generic ones since I get 3 per mutation. I use robust genetics. i may test out specific ones just to see if im more likely to get good ones even if you get less.

Mutation chances for the category mutations are identical to the normal mutation chances, 33% chance of being guaranteed a bad (or good with robust genetics) mutation, and then it’s a random mutation from all mutations in that category.

---

<div class="post-metadata">

**Author:** ![Livingstone](https://avatars.discourse-cdn.com/v4/letter/l/f0a364/32.png) [@Livingstone](https://discourse.cataclysmdda.org/u/Livingstone)\
**Post date:** [August 22, 2013, 2:24pm UTC](https://discourse.cataclysmdda.org/t/visualized-graph-of-trait-mutation-dependencies/2759/14 "2013-08-22T14:24:41Z")

</div>

The fact that one can get Carnivore with Meat Intolerance is certainly hilarious (the full food circle of inedibility)
