集合的视觉表示
我有一些实验数据,我决定将它们表示为集合。
假设有一个主集合 E={a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r ,s}(蓝色圆圈)和几个子集B(红色虚线省略号),其中包含主集中的元素<强>E。
我需要在主集中E中表示这些子集并显示它们的交集,或多或少类似于下图。
这就是为什么我需要一些算法(带有示例)来绘制该图。最好使用 PHP 或 Javascript(使用 SVG 规范),因为我将在 Web 应用程序中实现这个问题。
预先谢谢您!
I have some experimental data and I have decided to represent them as sets.
Let's say, there is a main set called E={a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s} (blue circle) and several sub-sets B (red dashed ellipses) which contains elements from main set E.
I need to represent these sub-sets in the main set E and show their intersections, more or less similar to the figure below.
That's why I need some algorithms (with an example) to draw that figure. Preferably in PHP or Javascript (using SVG specification), because I am going to implement this problem in a Web Application.
Thank you beforehand!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我的感觉是,这是 遗传算法 擅长的事情,因为:
对于适应度函数的另一个重要建议:严重惩罚任何一个子集的周长包含不属于该集合的元素的解决方案。
我的建议是使用元素的凸包作为子集周长(或者甚至可能是边界框,这更简单)。确定最佳位置后,您可以使用样条线绘制周长,使其美观且平滑。
My feeling is that this is something that a genetic algorithm would be good at, because:
Another important suggestion for the fitness function: heavily penalise any solution where one subset's perimeter encloses an element that does not belong to that set.
My suggestion is to work with convex hulls of elements for subset perimeters (or possibly even bounding boxes, which are even simpler). Once optimal locations have been decided, you can draw the perimeters using splines to make them nice and smooth.