Skip to content

Conversation

@zqqcee
Copy link

@zqqcee zqqcee commented Sep 8, 2023

change point:

1 allowTraversal

我认为bfs与dfs的allowTraversal这个地方,不应该把seen放在这里,因为图中bfs和dfs都默认每个节点只走一次,不然无法跳出循环。 所以allowTraversal这个函数只用于【把一些特定的边给禁掉,在bfs或dfs的时候不能走这些边】,而判断一个节点之前有没有被访问过的逻辑不应该放在这个地方

old version:

//init
const allowTraversalCallback = (() => {
    const seen: { [key: NodeID]: boolean } = { [startNodeId]: true };
    return (param: { previous?: NodeID; current?: NodeID; next: NodeID }) => {
      const id: NodeID = param.next;
      if (!seen[id]) {
        seen[id] = true;
        return true;
      }
      return false;
    };
  })();

new version:

//init
const allowTraversalCallback = ()=>true;

2 类型检查

添加了基本数据结构的类型检查,Stack,Queue,LinkedList

@Yanyan-Wang
Copy link
Contributor

antvis/G6#4921

@Yanyan-Wang Yanyan-Wang merged commit 745bb0f into antvis:next Sep 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants