Skip to content

Commit ce928eb

Browse files
authored
update for graphrag v0.5.0 (#26)
1 parent 1006133 commit ce928eb

13 files changed

+235
-235
lines changed

README.md

+5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99

1010
GraphRAG Visualizer is an application designed to visualize Microsoft [GraphRAG](https://github.com/microsoft/graphrag) artifacts. By uploading parquet files generated from the GraphRAG indexing pipeline, users can easily view and analyze data without needing additional software or scripts.
1111

12+
## Important Note
13+
14+
If you are using **GraphRAG 0.3.x or below**, please use the legacy version of GraphRAG Visualizer available at:
15+
👉 [GraphRAG Visualizer Legacy](https://noworneverev.github.io/graphrag-visualizer-legacy)
16+
1217
## Features
1318

1419
- **Graph Visualization**: View the graph in 2D or 3D in the "Graph Visualization" tab.

src/app/components/GraphViewer.tsx

+6-7
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import {
2121
import FullscreenIcon from "@mui/icons-material/Fullscreen";
2222
import FullscreenExitIcon from "@mui/icons-material/FullscreenExit";
2323
import SearchIcon from "@mui/icons-material/Search";
24-
import DeleteIcon from "@mui/icons-material/Delete";
2524
import Fuse from "fuse.js";
2625
import {
2726
CSS2DRenderer,
@@ -525,10 +524,10 @@ const GraphViewer: React.FC<GraphViewerProps> = ({
525524
? includeTextUnits && includeCommunities && includeCovariates
526525
: includeTextUnits && includeCommunities;
527526

528-
const clearSearchResults = () => {
529-
setGraphData(initialGraphData.current);
530-
setApiSearchResults(null);
531-
};
527+
// const clearSearchResults = () => {
528+
// setGraphData(initialGraphData.current);
529+
// setApiSearchResults(null);
530+
// };
532531

533532
return (
534533
<Box
@@ -881,7 +880,7 @@ const GraphViewer: React.FC<GraphViewerProps> = ({
881880
>
882881
<Typography variant="body2">Nodes: {nodeCount}</Typography>
883882
<Typography variant="body2">Relationships: {linkCount}</Typography>
884-
<Button
883+
{/* <Button
885884
variant="contained"
886885
onClick={toggleApiDrawer(true)}
887886
startIcon={<SearchIcon />}
@@ -896,7 +895,7 @@ const GraphViewer: React.FC<GraphViewerProps> = ({
896895
disabled={apiSearchResults === null}
897896
>
898897
Clear Query Results
899-
</Button>
898+
</Button> */}
900899
</Box>
901900
</Box>
902901
);

src/app/components/Introduction.tsx

+12
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,18 @@ const Introduction: React.FC = () => {
2020
Welcome to the GraphRAG Visualizer
2121
</Typography>
2222

23+
<Typography variant="body1" gutterBottom sx={{ color: "error.main" }}>
24+
If you are using <strong>GraphRAG 0.3.x or below</strong>, please visit
25+
the legacy site:{" "}
26+
<Link
27+
href="https://noworneverev.github.io/graphrag-visualizer-legacy"
28+
target="_blank"
29+
rel="noopener"
30+
>
31+
GraphRAG Visualizer Legacy
32+
</Link>
33+
</Typography>
34+
2335
<Typography variant="h6" gutterBottom>
2436
Overview
2537
</Typography>

src/app/hooks/useGraphData.ts

+11-17
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,12 @@ const useGraphData = (
2626
useEffect(() => {
2727
const nodes: CustomNode[] = entities.map((entity) => ({
2828
uuid: entity.id,
29-
id: entity.name,
30-
name: entity.name,
29+
id: entity.title,
30+
name: entity.title,
3131
type: entity.type,
3232
description: entity.description,
33-
human_readable_id: entity.human_readable_id,
34-
graph_embedding: entity.graph_embedding,
35-
text_unit_ids: entity.text_unit_ids,
36-
description_embedding: entity.description_embedding,
33+
human_readable_id: entity.human_readable_id,
34+
text_unit_ids: entity.text_unit_ids,
3735
neighbors: [],
3836
links: [],
3937
}));
@@ -51,9 +49,7 @@ const useGraphData = (
5149
text_unit_ids: relationship.text_unit_ids,
5250
id: relationship.id,
5351
human_readable_id: relationship.human_readable_id,
54-
source_degree: relationship.source_degree,
55-
target_degree: relationship.target_degree,
56-
rank: relationship.rank,
52+
combined_degree: relationship.combined_degree,
5753
}))
5854
.filter((link) => nodesMap[link.source] && nodesMap[link.target]);
5955

@@ -66,8 +62,9 @@ const useGraphData = (
6662
name: document.title,
6763
title: document.title,
6864
type: "RAW_DOCUMENT", // avoid conflict with "DOCUMENT" type
69-
raw_content: document.raw_content,
65+
text: document.text,
7066
text_unit_ids: document.text_unit_ids,
67+
human_readable_id: document.human_readable_id,
7168
neighbors: [],
7269
links: [],
7370
}));
@@ -102,6 +99,7 @@ const useGraphData = (
10299
document_ids: textunit.document_ids,
103100
entity_ids: textunit.entity_ids,
104101
relationship_ids: textunit.relationship_ids,
102+
human_readable_id: textunit.human_readable_id,
105103
neighbors: [],
106104
links: [],
107105
}));
@@ -230,17 +228,13 @@ const useGraphData = (
230228
// type: "COVARIATE",
231229
type: covariate.type,
232230
description: covariate.description || "",
233-
subject_id: covariate.subject_id,
234-
subject_type: covariate.subject_type,
235-
object_id: covariate.object_id,
236-
object_type: covariate.object_type,
231+
subject_id: covariate.subject_id,
232+
object_id: covariate.object_id,
237233
status: covariate.status,
238234
start_date: covariate.start_date,
239235
end_date: covariate.end_date,
240236
source_text: covariate.source_text,
241-
text_unit_id: covariate.text_unit_id,
242-
document_ids: covariate.document_ids,
243-
n_tokens: covariate.n_tokens,
237+
text_unit_id: covariate.text_unit_id,
244238
neighbors: [],
245239
links: [],
246240
}));

src/app/models/community-report.ts

+38-23
Original file line numberDiff line numberDiff line change
@@ -6,66 +6,77 @@ export interface Finding {
66
}
77

88
export interface CommunityReport {
9+
id: string;
10+
human_readable_id: number;
911
community: number;
10-
full_content: string;
1112
level: number;
12-
rank: number;
1313
title: string;
14-
rank_explanation: string;
1514
summary: string;
15+
full_content: string;
16+
rank: number;
17+
rank_explanation: string;
1618
findings: Finding[];
1719
full_content_json: string;
18-
id: string;
20+
period: string;
21+
size: number;
1922
}
2023

2124
export const findingColumns: MRT_ColumnDef<Finding>[] = [
2225
{
2326
accessorKey: "id",
24-
header: "ID",
27+
header: "id",
2528
},
2629
{
2730
accessorKey: "explanation",
28-
header: "Explanation",
31+
header: "explanation",
2932
},
3033
{
3134
accessorKey: "summary",
32-
header: "Summary",
35+
header: "summary",
3336
},
3437

3538
]
3639

3740
export const communityReportColumns: MRT_ColumnDef<CommunityReport>[] = [
3841
{
39-
accessorKey: "community",
40-
header: "Community",
42+
accessorKey: "id",
43+
header: "id",
44+
},
45+
{
46+
accessorKey: "human_readable_id",
47+
header: "human_readable_id",
4148
},
4249
{
43-
accessorKey: "full_content",
44-
header: "Full Content",
50+
accessorKey: "community",
51+
header: "community",
4552
},
4653
{
4754
accessorKey: "level",
48-
header: "Level",
55+
header: "level",
4956
},
5057
{
51-
accessorKey: "rank",
52-
header: "Rank",
58+
accessorKey: "title",
59+
header: "title",
5360
},
5461
{
55-
accessorKey: "title",
56-
header: "Title",
62+
accessorKey: "summary",
63+
header: "summary",
5764
},
5865
{
59-
accessorKey: "rank_explanation",
60-
header: "Rank Explanation",
66+
accessorKey: "full_content",
67+
header: "full_content",
6168
},
6269
{
63-
accessorKey: "summary",
64-
header: "Summary",
70+
accessorKey: "rank",
71+
header: "rank",
72+
},
73+
{
74+
accessorKey: "rank_explanation",
75+
header: "rank_explanation",
6576
},
6677
{
6778
accessorKey: "findings",
68-
header: "Findings",
79+
header: "findings",
6980
Cell: ({ renderedCellValue }) =>
7081
Array.isArray(renderedCellValue)
7182
? JSON.stringify(renderedCellValue, null, 2)
@@ -76,7 +87,11 @@ export const communityReportColumns: MRT_ColumnDef<CommunityReport>[] = [
7687
header: "Full Content JSON",
7788
},
7889
{
79-
accessorKey: "id",
80-
header: "ID",
90+
accessorKey: "period",
91+
header: "period",
92+
},
93+
{
94+
accessorKey: "size",
95+
header: "size",
8196
},
8297
];

src/app/models/community.ts

+34-10
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,68 @@ import { MRT_ColumnDef } from "material-react-table";
22

33
export interface Community {
44
id: number;
5-
title: string;
5+
human_readable_id: number;
6+
community: number;
67
level: number;
7-
raw_community: number;
8+
title: string;
9+
entity_ids: string[];
810
relationship_ids: string[];
911
text_unit_ids: string[];
12+
period: string;
13+
size: number;
1014
}
1115

1216
export const communityColumns: MRT_ColumnDef<Community>[] = [
1317
{
1418
accessorKey: "id",
15-
header: "ID",
19+
header: "id",
1620
},
1721
{
18-
accessorKey: "title",
19-
header: "Title",
22+
accessorKey: "human_readable_id",
23+
header: "human_readable_id",
24+
},
25+
{
26+
accessorKey: "community",
27+
header: "community",
2028
},
2129
{
2230
accessorKey: "level",
23-
header: "Level",
31+
header: "level",
2432
},
2533
{
26-
accessorKey: "raw_community",
27-
header: "Raw Community",
34+
accessorKey: "title",
35+
header: "title",
36+
},
37+
{
38+
accessorKey: "entity_ids",
39+
header: "entity_ids",
40+
Cell: ({ renderedCellValue }) =>
41+
Array.isArray(renderedCellValue)
42+
? JSON.stringify(renderedCellValue, null, 2)
43+
: renderedCellValue,
2844
},
2945
{
3046
accessorKey: "relationship_ids",
31-
header: "Relationship IDs",
47+
header: "relationship_ids",
3248
Cell: ({ renderedCellValue }) =>
3349
Array.isArray(renderedCellValue)
3450
? JSON.stringify(renderedCellValue, null, 2)
3551
: renderedCellValue,
3652
},
3753
{
3854
accessorKey: "text_unit_ids",
39-
header: "Text Unit IDs",
55+
header: "text_unit_ids",
4056
Cell: ({ renderedCellValue }) =>
4157
Array.isArray(renderedCellValue)
4258
? JSON.stringify(renderedCellValue, null, 2)
4359
: renderedCellValue,
4460
},
61+
{
62+
accessorKey: "period",
63+
header: "period",
64+
},
65+
{
66+
accessorKey: "size",
67+
header: "size",
68+
},
4569
];

0 commit comments

Comments
 (0)