AddConnection in script does not show in editor

I checed the show graph, and when I use the scan button and the blue lines show in the editor. But when I add nodes and connections by script in editor , the connection created but no blue line shows.

public class NavGenEditor : EditorWindow
{
    private void AddPoints()
    {
            var node1 = astarPath.data.pointGraph.AddNode(new Int3(0, 2, 0));
            var node2 = astarPath.data.pointGraph.AddNode(new Int3(1, 2, 0));
            var node3 = astarPath.data.pointGraph.AddNode(new Int3(2, 2, 0));
            node1.AddConnection(node2, cost);
            node2.AddConnection(node1, cost);
            node2.AddConnection(node3, cost);
            node3.AddConnection(node2, cost);
            var isValid = node1.ContainsConnection(node2);
            Debug.Log(isValid); // Yes
    }
}

Hmmm, I think that’s a bug right now. It might be drawing stale data. Could you try switching to another graph coloring mode and then back again and see if that causes it to render the connections properly? (A* Inspector → Settings → Debug → Graph Coloring).

Note that Int3s are in millimeters, not meters. So those nodes are really close together. You probably want e.g. new Int3(0, 2000, 0) instead of Int3(0, 2, 0).