简体   繁体   English

从一个起始节点中寻找最合适的节点,起始和结束节点是间接连接的,边是加权的

[英]Find most suitable nodes from a starting node, start and end nodes are indirectly connected and edges are weighted

in the image below is a subgraph of my whole graph shown.下图中是我显示的整个图表的子图。 I have three different kind of nodes, green, blue and violet ones.我有三种不同类型的节点,绿色、蓝色和紫色节点。

The green and violet ones are indirectly connected via the blue nodes.绿色和紫色的通过蓝色节点间接连接。

Blue nodes are connected among each other with directed edges which are weighted.蓝色节点通过加权的有向边相互连接。 The blue edges are weighted but not the green or violet ones.蓝色边缘被加权,但绿色或紫色边缘没有加权。

The problem I want to solve is the following: I would like to find the most suitable violet nodes to the green one.我要解决的问题如下:我想找到最适合绿色节点的紫色节点。 , eg I want be able to say that for green node GA the three most suitable violet nodes are V1 , V4 , V42 . ,例如,我想说对于绿色节点GA ,三个最合适的紫色节点是V1V4V42

What makes a node suitable?什么使节点适合?

A perfect match would be when the green node connects to all blue nodes the violet one connects to.完美匹配是绿色节点连接到紫色节点连接的所有蓝色节点。 However, the green node could connect to more blue nodes.但是,绿色节点可以连接到更多的蓝色节点。 This would still be the best score for a violet node.这仍然是紫色节点的最佳分数。

If green and violet do not connect to the same blue node but to blue nodes that are connected to each other the algorithm needs to take the weights of the edges between the blue nodes into account.如果绿色和紫色不连接到同一个蓝色节点,而是连接到彼此连接的蓝色节点,则算法需要考虑蓝色节点之间的边的权重。 This could not result in a perfect match but still a good match.这不会导致完美匹配,但仍然是一个很好的匹配。

What makes it more or less suitable?是什么让它或多或少适合?

The more hops between blue nodes are needed to connect blue nodes the green and violet nodes are connected the smaller the score of the violet node is.连接蓝色节点所需的蓝色节点之间的跳数越多,连接绿色和紫色节点的节点越小,紫色节点的得分越小。 Also if the weight between the blue nodes is the lesser the score of the violet node is, here the direction from green to violet is the one to consider.此外,如果蓝色节点之间的权重越小,紫色节点的得分越小,这里要考虑从绿色到紫色的方向。

If the green is not connected to some blue nodes, it would be a penalty and the score for the violet node would be smaller.如果绿色没有连接到一些蓝色节点,这将是一个惩罚,紫色节点的分数会更小。

What graph algorithms can you think of to solve this problem?你能想到什么图算法来解决这个问题?

I am planning to use the neo4j database.我打算使用 neo4j 数据库。

我的子图

A perfect match would be when the green node connects to all blue nodes the violet one connects to.完美匹配是绿色节点连接到紫色节点连接的所有蓝色节点。

I think that this means there is a path from a green node to a violet one that passes through just one blue node.认为这意味着从绿色节点到紫色节点的路径仅通过一个蓝色节点。 If there is more than one violet node that is just one blue node away from a green node, then you want all such vilet nodes.如果有不止一个紫色节点距离绿色节点只有一个蓝色节点,那么您需要所有这些紫色节点。 Please confirm this.请确认。

If my guess about your requirement is correct, then the Dijsktra algoritm will give your answer.如果我对您的要求的猜测是正确的,那么 Dijsktra 算法将给出您的答案。 The algorithm will tell you how far away every violet node is from each green node - so you can filter out the ones that are exactly two hops away.该算法将告诉您每个紫色节点与每个绿色节点的距离——因此您可以过滤掉正好两跳远的节点。

Do you have a sample dataset?你有样本数据集吗?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 在加权图中查找从节点到所有其他节点的距离 - Find distance from node to all other nodes in a weighted graph 给定具有自循环的有向加权图,找到与给定节点x完全相距k dist的节点列表? - Given a directed weighted graph with self loops ,find the list of nodes that are exactly k dist from a given node x? 具有指定开始和结束节点的有向图论算法,它找到访问权重最小的最多节点的路径 - Directed graph theory algorithm with specified start and end nodes which finds a path that visits the most nodes with the least weight 如何使用邻接矩阵查找节点是否在边加权图上连接 - how to find if nodes are connected on a edge-weighted graph using adjacency matrix 在十亿个节点的无向​​图中无循环地从正好k个边的源节点中找到目标节点的算法/方法 - Algorithm/Approach to find destination node from source node of exactly k edges in undirected graph of billion nodes without cycle 在grpah中,找到所有连接到一个节点但未连接到另一个节点的节点的最快方法是什么? - in grpah what will be the fastest way to find all the nodes connected to one node but not connected to another node.? 查找覆盖 k 条边的图的节点数 - Find number of nodes of a graph that cover k edges 查找具有给定节点数和边数的图的算法 - Algorithm to find a graph with given number of nodes and edges 频繁更新新边缘时检查是否连接了两个节点 - Check if two nodes are connected when updating new edges frequently 给定无向加权连通图,s,t。 找到从s到t的路径,其最大加权边缘尽可能低 - Given undirected weighted connected graph, s,t. Find path from s to t that its most weighted edge is low as possible
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM