Skip to main content

GraphVisual

Debug view of a [Graph]: a ball per node and a bar per link, purple and see-through by default. Pass the graph itself or its node list.

local graph = VluxyAI.Pathfinders.Graph.new(nodes)
VluxyAI.Debug.GraphVisual.new(graph)

Functions​

Edges​

GraphVisual.Edges(nodes: {GraphNode}) → {GraphEdge}--

Each connected pair once, lower index first, in node order.

Types

​

interface GraphEdge {
From: number--

The lower node index.

To: number--

The higher node index.

Label: string?--

The link's label, when either direction has one (a door).

}

The undirected edges of a directed node list: a link from 3 to 7 and one from 7 to 3 are one edge. A label on either direction is kept. Pure.

new​

GraphVisual.new(
graph: Pathfinder | {GraphNode},--

A Graph (anything with GetNodes) or the node list itself.

) → GraphVisual

Types

​

interface GraphVisualOptions {
Color: Color3?--

Colour of the nodes and links. Default purple.

Transparency: number?--

Default 0.5.

NodeSize: number?--

Diameter of a node ball in studs. Default 1.2.

LinkThickness: number?--

Width of a link bar in studs. Default 0.2.

Nodes: boolean?--

Draw the nodes. Turn it off when the nodes are visible parts already. Default true.

Links: boolean?--

Draw the links. Default true.

Height: number?--

Studs above each node's floor position to draw at. Default 0.6.

}

Draws the graph once. The nodes of a Graph do not move, so there is nothing to redraw; destroy it and make another after changing the node list.

Errors

TypeDescription
"unknown option"A key that is not in `GraphVisualOptions`.

Destroy​

GraphVisual.Destroy(self: GraphVisual) → ()

Removes the drawing.

Show raw api
{
    "functions": [
        {
            "name": "Edges",
            "desc": "The undirected edges of a directed node list: a link from 3 to 7 and one from 7 to 3 are one\nedge. A label on either direction is kept. Pure.",
            "params": [
                {
                    "name": "nodes",
                    "desc": "",
                    "lua_type": "{ GraphNode }"
                }
            ],
            "returns": [
                {
                    "desc": "Each connected pair once, lower index first, in node order.",
                    "lua_type": "{ GraphEdge }"
                }
            ],
            "function_type": "static",
            "source": {
                "line": 122,
                "path": "lib/Debug/GraphVisual.luau"
            }
        },
        {
            "name": "new",
            "desc": "Draws the graph once. The nodes of a [Graph] do not move, so there is nothing to redraw;\ndestroy it and make another after changing the node list.",
            "params": [
                {
                    "name": "graph",
                    "desc": "A [Graph] (anything with `GetNodes`) or the node list itself.",
                    "lua_type": "Pathfinder | { GraphNode }"
                },
                {
                    "name": "options",
                    "desc": "",
                    "lua_type": "GraphVisualOptions?"
                }
            ],
            "returns": [
                {
                    "desc": "",
                    "lua_type": "GraphVisual"
                }
            ],
            "function_type": "static",
            "errors": [
                {
                    "lua_type": "\"unknown option\"",
                    "desc": "A key that is not in `GraphVisualOptions`."
                }
            ],
            "source": {
                "line": 182,
                "path": "lib/Debug/GraphVisual.luau"
            }
        },
        {
            "name": "Destroy",
            "desc": "Removes the drawing.",
            "params": [
                {
                    "name": "self",
                    "desc": "",
                    "lua_type": "GraphVisual"
                }
            ],
            "returns": [],
            "function_type": "static",
            "source": {
                "line": 227,
                "path": "lib/Debug/GraphVisual.luau"
            }
        }
    ],
    "properties": [],
    "types": [
        {
            "name": "GraphVisualOptions",
            "desc": "",
            "fields": [
                {
                    "name": "Color",
                    "lua_type": "Color3?",
                    "desc": "Colour of the nodes and links. Default purple."
                },
                {
                    "name": "Transparency",
                    "lua_type": "number?",
                    "desc": "Default `0.5`."
                },
                {
                    "name": "NodeSize",
                    "lua_type": "number?",
                    "desc": "Diameter of a node ball in studs. Default `1.2`."
                },
                {
                    "name": "LinkThickness",
                    "lua_type": "number?",
                    "desc": "Width of a link bar in studs. Default `0.2`."
                },
                {
                    "name": "Nodes",
                    "lua_type": "boolean?",
                    "desc": "Draw the nodes. Turn it off when the nodes are visible parts already. Default `true`."
                },
                {
                    "name": "Links",
                    "lua_type": "boolean?",
                    "desc": "Draw the links. Default `true`."
                },
                {
                    "name": "Height",
                    "lua_type": "number?",
                    "desc": "Studs above each node's floor position to draw at. Default `0.6`."
                }
            ],
            "source": {
                "line": 52,
                "path": "lib/Debug/GraphVisual.luau"
            }
        },
        {
            "name": "GraphEdge",
            "desc": "",
            "fields": [
                {
                    "name": "From",
                    "lua_type": "number",
                    "desc": "The lower node index."
                },
                {
                    "name": "To",
                    "lua_type": "number",
                    "desc": "The higher node index."
                },
                {
                    "name": "Label",
                    "lua_type": "string?",
                    "desc": "The link's label, when either direction has one (a door)."
                }
            ],
            "source": {
                "line": 70,
                "path": "lib/Debug/GraphVisual.luau"
            }
        }
    ],
    "name": "GraphVisual",
    "desc": "Debug view of a [Graph]: a ball per node and a bar per link, purple and see-through by\ndefault. Pass the graph itself or its node list.\n\n```lua\nlocal graph = VluxyAI.Pathfinders.Graph.new(nodes)\nVluxyAI.Debug.GraphVisual.new(graph)\n```",
    "source": {
        "line": 98,
        "path": "lib/Debug/GraphVisual.luau"
    }
}