tag:blogger.com,1999:blog-36017112.post4752339731529175767..comments2021-04-19T05:40:21.238+01:00Comments on Featherweight Musings: Graphs in RustUnknownnoreply@blogger.comBlogger5125tag:blogger.com,1999:blog-36017112.post-68603942464042628162021-01-23T15:08:39.615+00:002021-01-23T15:08:39.615+00:00Thanks for sharing the best information and sugges...Thanks for sharing the best information and suggestions, I love your content, and they are very nice and very useful to us. If you are looking for the best <a href="https://www.igmguru.com/data-science-bi/python-training/" rel="nofollow"><b>applied data science with python</b></a>, then visit igmguru.com. I appreciate the work you have put into this.Christina Alpandahttps://www.blogger.com/profile/16498068216148034127noreply@blogger.comtag:blogger.com,1999:blog-36017112.post-27820449536429805942018-11-20T09:11:55.576+00:002018-11-20T09:11:55.576+00:00A graph is just a tuple G = (V, E) where V is some...A graph is just a tuple G = (V, E) where V is some set of vertices, and E a set of edges, generally represented as tuples of vertices. In general, either your vertices or your edges are implicit to some degree. And lots of things in your program form graphs with or without your awareness or intention. Becoming aware of hidden graph structures in your code is often an "ah-hah" moment.<br /><br />There are tons of ways to represent graphs. There is no precondition that they be either pointer-based or dynamic. You can form graphs from anything that allows any kind of associativity: arrays, genejric maps, function calls (as mentioned above), match statements, etc.<br /><br />The point is you have a set of "things", and you have a set of "pairs of things", where each item in a given pair is a "thing". If you have a set of "things", and *any* other structure in your code which associates pairs of "things", that forms a graph -- whether or not that is what you indended!<br /><br />It's very easy to form static graphs. For example, you can represent vertices as functions, edges as calls from one function to another. Yes: every program consists of a graph over functions! You could represent nodes as enum values, and edges as match clauses. Whether or not you intend, this forms a graph.<br /><br />It's not that hard, guys.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-36017112.post-43323400530657069812015-04-08T10:48:55.585+01:002015-04-08T10:48:55.585+01:00In Mezzo, they use a dynamic mechanism called &quo...In Mezzo, they use a dynamic mechanism called "adoption and abandon" as a way to handle shared/cyclic nodes in a relatively ergonomic way (but paying the cost of a runtime check when taking ownership of a node during traversal).<br /><br />See for example <a href="http://gallium.inria.fr/~fpottier/20140429-ihp/code/graph.mz" rel="nofollow">this code example</a> for graphs. Adoption and Abandon has been described in various places, such as <a href="http://gallium.inria.fr/blog/introduction-to-mezzo-2/" rel="nofollow">this blog post</a>.gaschenoreply@blogger.comtag:blogger.com,1999:blog-36017112.post-87958320819204663632015-04-06T20:05:11.806+01:002015-04-06T20:05:11.806+01:00I just wrote a quick post showing another way to m...I just wrote a quick post showing another way to model graphs:<br /><br />http://smallcultfollowing.com/babysteps/blog/2015/04/06/modeling-graphs-in-rust-using-vector-indices/<br /><br />I would offer a slight correction to the previous commenter, though: the option of tracing Gc is not currently available, but it is something I hope we will work on soon.Anonymoushttps://www.blogger.com/profile/17747970382445176700noreply@blogger.comtag:blogger.com,1999:blog-36017112.post-51550800809799132762015-04-05T05:08:54.612+01:002015-04-05T05:08:54.612+01:00Seems to me it would be really nice to have the op...Seems to me it would be really nice to have the option of saying "I don't care about managing lifetimes myself here, just use a tracing GC for all this stuff".<br /><br />I know that was once part of the Rust plan, and then the plan was to push it out to a library with language support for tracing hooks, and it seems now the option has disappeared entirely. Which makes me sad.Roberthttps://www.blogger.com/profile/01801341049800948737noreply@blogger.com