gephi / gephi/gephi-lite

Graphology JSON import fails with `invalid nodes. Expecting an array`

Open
#339 1 comment 0 reactions 0 assignees View on GitHub
bug
Dominant language
TypeScript
Stars
351
Forks
48
Avg merge
10h 21m
Merged PRs (30d)
1

Description

- Gephi Lite version : 1.0.2
- Operating system: Windows 11
- Web browser: Edge 152.0.4191.66
Gephi Lite v1.0.2 rejects a minimal valid Graphology JSON file during Workspace > Open.

Reproduction:
```
{
"attributes": { "name": "Test" },
"nodes": [
{ "key": "a" },
{ "key": "b" }
],
"edges": [
{
"key": "a-b",
"source": "a",
"target": "b",
"attributes": { "weight": 1 }
}
]
}
```
Actual result:

`Graph.import: invalid nodes. Expecting an array`

The same error occurs with the canonical Graphology JSON structure and without graph options.

Suspected cause: gephiLiteParse() uses a JSON reviver that converts the root object into a Graphology instance when it sees nodes and edges. The importer then checks jsonContent.nodes && jsonContent.edges and calls Graph.from(jsonContent) again. At that point nodes is a method rather than the serialized nodes array.

Expected result: the JSON should be passed to Graph.from() before, or instead of, the reviver converting it into a Graphology instance.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at gephiLiteParse and trace the Workspace > Open import path while reproducing the provided minimal Graphology JSON failure. Check how the JSON reviver and the subsequent Graph.from call interact, then verify that the file opens without the invalid-nodes error and preserves its nodes and edge.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
data-visualization, web-dev
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.