neo4j-contrib / neovis.js

Neo4j + vis.js = neovis.js. Graph visualizations in the browser with data from Neo4j.
Apache License 2.0
1.59k stars 324 forks source link

dataFunction not rendering graph with optional matches where relationships are null #379

Open exoup opened 7 months ago

exoup commented 7 months ago

Expected Behavior (Mandatory)

Using dataFunction to render a graph with optional matches (i.e. where nodes may be null) should still render. This does work when using cypher to generate a graph.

Actual Behavior (Mandatory)

Graphs fails to render.

With consoleDebug: true, the nodes with null never appear in the console log, whereas they do appear when using an initial cypher instead.

How to Reproduce the Problem

Use a datafunction that has an optional match that returns at least one node as null, and then attempt to render the graph.

Simple Example

Sample dataset

[
    {
        "keys": [
            "u",
            "k",
            "u2"
        ],
        "length": 3,
        "_fields": [
            {
                "identity": {
                    "low": 9,
                    "high": 0
                },
                "labels": [
                    "User"
                ],
                "properties": {
                    "name": "Eva Brown",
                    "id": "24e7bca8-c637-45d0-abc0-21885956bb06",
                    "department": "Sales",
                    "title": "Sales Representative",
                    "email": "eva.brown@acme.co"
                },
                "elementId": "4:e9e232fc-0370-45f3-bd2f-c086d1cdc93d:9"
            },
            {
                "identity": {
                    "low": 12,
                    "high": 272105984
                },
                "start": {
                    "low": 12,
                    "high": 0
                },
                "end": {
                    "low": 9,
                    "high": 0
                },
                "type": "KNOWS",
                "properties": {
                    "quality": {
                        "low": 3,
                        "high": 0
                    }
                },
                "elementId": "5:e9e232fc-0370-45f3-bd2f-c086d1cdc93d:1168686302325899276",
                "startNodeElementId": "4:e9e232fc-0370-45f3-bd2f-c086d1cdc93d:12",
                "endNodeElementId": "4:e9e232fc-0370-45f3-bd2f-c086d1cdc93d:9"
            },
            {
                "identity": {
                    "low": 12,
                    "high": 0
                },
                "labels": [
                    "User"
                ],
                "properties": {
                    "name": "Richard McGee",
                    "id": "e424e056-430e-42d4-8aa1-f7358f3b965e",
                    "department": "Operations",
                    "title": "Operations Manager",
                    "email": "richard.mcgee@acme.co"
                },
                "elementId": "4:e9e232fc-0370-45f3-bd2f-c086d1cdc93d:12"
            }
        ],
        "_fieldLookup": {
            "u": 0,
            "k": 1,
            "u2": 2
        }
    },
    {
        "keys": [
            "u",
            "k",
            "u2"
        ],
        "length": 3,
        "_fields": [
            {
                "identity": {
                    "low": 10,
                    "high": 0
                },
                "labels": [
                    "User"
                ],
                "properties": {
                    "name": "Michael Davis",
                    "id": "ab8d3ef9-f66f-4fbe-a58e-a8c295bdeb8f",
                    "department": "Engineering",
                    "title": "Senior Software Engineer",
                    "email": "michael.davis@acme.co"
                },
                "elementId": "4:e9e232fc-0370-45f3-bd2f-c086d1cdc93d:10"
            },
            null,
            null
        ],
        "_fieldLookup": {
            "u": 0,
            "k": 1,
            "u2": 2
        }
    }
]

Specifications (Mandatory)

Currently used versions

Versions

I suspect it's a similar issue to the one mentioned here regarding NaN: #265