具有本机/语法/内联图支持的语言?

发布于 2024-09-11 01:39:58 字数 229 浏览 1 评论 0原文

图可以说是最通用和最有价值的数据结构。我可以用它存储单个变量、列表、哈希等,当然还有图表。

鉴于此,是否有任何语言提供内联/本机图形支持和语法?我可以在 Ruby、Python 和 Javascript 中内联创建变量、数组、列表和哈希,但如果我想要一个图形,我必须使用矩阵/列表自己管理表示,或者选择一个库,并通过方法使用图形来电。

到底为什么2010年还是这样呢?实际上,是否有任何语言提供内联图支持和语法?

The graph is arguably the most versatile and valuable data structure of all. I can store single variables, lists, hashes etc., and of course graphs, with it.

Given this, are there any languages that offer inline / native graph support and syntax? I can create variables, arrays, lists and hashes inline in Ruby, Python and Javascript, but if I want a graph, I have to either manage the representation myself with a matrix / list, or select a library, and use the graph through method calls.

Why on earth is this still the case in 2010? And, practically, are there any languages out there which offer inline graph support and syntax?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

游魂 2024-09-18 01:39:58

您所问的主要问题是,更通用的解决方案并不是针对特定问题的最佳解决方案。对于所有人来说,这只是平均水平,但不是最好的。

好吧,你可以在图中存储一个列表,假设它是简并的,但为什么你应该这样做呢?如何在图表中存储哈希图?为什么需要这样的结构?

并且不要忘记,必须根据要对其执行的操作来选择图形实现,否则就像使用哈希表来存储值列表或使用列表来存储有序集合而不是树一样。您知道可以使用邻接矩阵、边列表或邻接列表......每种不同的实现都有其自己的优点和缺点。

然后,与其他数据集合相比,图可以具有很多属性,循环、非循环、有向、无向、二分等等......并且对于任何特定情况,您可以以不同的方式实现它们(假设您对图进行一些假设)需要),因此以本机语法使用它们会有点矫枉过正,因为无论如何您都需要配置它们(并且语言应该提供许多实现/优化)。

如果一切都已经做好了,那么你就失去了开发的乐趣:)
顺便说一句,只需寻找一种允许您编写自己的图形 DSL 并接受它的语言即可!

The main problem of what you are asking is that a more general solution is not the best one for a specific problem. It's just average for all of them but not a best one.

Ok, you can store a list in a graph assuming its degeneracy but why should you do something like that? And how would you store an hashmap inside a graph? Why would you need such a structure?

And do not forgot that graph implementation must be chosen accordingly to which operations you are going to do on it, otherwise it would be like using a hashtable to store a list of values or a list to store an ordered collection instead that a tree. You know that you can use an adjacency matrix, an edge list or adjacency lists.. every different implementation with it's own strenghts and weaknesses.

Then graphs can have really many properties compared to other collections of data, cyclic, acyclic, directed, undirected, bipartite, and so on.. and for any specific case you can implement them in a different way (assuming some hypothesis on the graph you need) so having them in native syntax would be overkill since you would need to configure them anyway (and language should provide many implementations/optimizations).

If everything is already made you remove the fun of developing :)
By the way just look for a language that allows you to write your own graph DSL and live with it!

淡淡的优雅 2024-09-18 01:39:58

Gremlin,一种基于图形的编程语言:https://github.com/tinkerpop/gremlin/wiki

Gremlin, a graph-based programming language: https://github.com/tinkerpop/gremlin/wiki

少年亿悲伤 2024-09-18 01:39:58

GrGen.NET (www.grgen.net) 是一种用于图形转换的编程语言以及包含图形调试器的环境。您可以使用一些不错的专用语言定义图形模型、重写规则和规则控制,并使用您喜欢的任何 .NET 语言或提供的 shell 生成的程序集/C# 代码。

要理解为什么普通语言不提供如此方便/内置的图形接口,只需看看为该项目编写的代码量即可:仅编译器就需要几个人年的工作。对于只有少数程序员需要的功能/数据结构来说,这个价格太高了 - 因此它不包含在通用编程语言中。

GrGen.NET (www.grgen.net) is a programming language for graph transformation plus an environment including a graphical debugger. You can define your graph model, the rewrite rules, and rule control with some nice special purpose languages and use the generated assemblies/C# code from any .NET language you like or from the supplied shell.

To understand why normal languages don't offer such a convenient/built-in interface to graphs, just take a look at the amount of code written for that project: the compiler alone is several man-years of work. That's a price tag too hefty for a feature/data structure only a minority of programmers ever need - so it's not included in general purpose programming languages.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文