# doc2graph | Andrea Gemelli | Knowledge Base | Instagit

Doc2Graph transforms documents into graphs and exploit a GNN to solve several tasks.

GitHub Stars: 137

Repository: https://github.com/andreagemelli/doc2graph

---

## Articles

### [How Doc2Graph Handles Layout Analysis and Table Detection: A Technical Deep Dive](/andreagemelli/doc2graph/how-does-doc2graph-handle-layout-analysis-and-table-detection-tasks)

Discover how Doc2Graph leverages geometric edge features and edge classification for effective layout analysis and table detection in scanned documents. Learn the technical details.

- Tags: deep-dive
- Published: 2026-02-24

### [How to Debug Issues with Graph Construction from PDF Documents in doc2graph](/andreagemelli/doc2graph/how-do-i-debug-issues-with-graph-construction-from-pdf-documents)

Debug doc2graph PDF issues. Learn how to fix unimplemented methods causing errors during graph construction from PDF files and prevent crashes.

- Tags: how-to-guide
- Published: 2026-02-24

### [How the knn_connection Algorithm Finds Neighboring Bounding Boxes in doc2graph](/andreagemelli/doc2graph/how-does-the-knn_connection-algorithm-find-neighboring-bounding-boxes)

Learn how the knn_connection algorithm in doc2graph builds a spatial kNN graph using projection maps, expanding search windows, and Euclidean distance to find neighboring bounding boxes.

- Tags: internals
- Published: 2026-02-24

### [How to Create a Custom Model Configuration in doc2graph by Modifying YAML Files](/andreagemelli/doc2graph/how-do-i-create-a-custom-model-configuration-by-modifying-yaml-files)

Learn to create a custom model configuration in doc2graph by modifying YAML files. Adjust hyperparameters and load your custom settings easily for enhanced training.

- Tags: how-to-guide
- Published: 2026-02-24

### [DGL RPC Vulnerabilities: Security Considerations for the doc2graph Repository](/andreagemelli/doc2graph/what-are-the-security-considerations-regarding-dgl-rpc-vulnerabilities)

Secure your doc2graph projects by understanding DGL RPC vulnerabilities. Learn how this repository mitigates risks by restricting Deep Graph Library operations locally, preventing unauthorized remote access.

- Tags: security
- Published: 2026-02-24

### [How Doc2Graph Saves Inference Results as JSON and Visualization Images](/andreagemelli/doc2graph/how-does-doc2graph-save-inference-results-as-json-and-visualization-images)

Discover how Doc2Graph saves inference results as JSON and PNG images. Explore extracted key-value pairs and visualized relationships stored in the inference folder.

- Tags: how-to-guide
- Published: 2026-02-24

### [Understanding the --add-eweights Flag in doc2graph: Enabling Geometric Edge Features and Weights](/andreagemelli/doc2graph/what-is-the-purpose-of-the-add-eweights-flag-for-edge-features)

Unlock geometric edge features and weights with the --add-eweights flag in doc2graph. Enhance GNNs by capturing spatial relationships with polar coordinates. Learn more!

- Tags: deep-dive
- Published: 2026-02-24

### [How to Switch Between FUNSD and PAU Datasets for Training in Doc2Graph](/andreagemelli/doc2graph/how-do-i-switch-between-funsd-and-pau-datasets-for-training)

Easily switch between FUNSD and PAU datasets for Doc2Graph training using the `src-data` argument in main.py. Select your preferred dataset and optimize your graph generation.

- Tags: how-to-guide
- Published: 2026-02-24

### [How Doc2Graph Uses EasyOCR for Text Extraction in Custom Inference](/andreagemelli/doc2graph/how-does-doc2graph-use-easyocr-for-text-extraction-in-custom-inference)

Discover how Doc2Graph uses EasyOCR to extract text for custom inference, converting detected text and polygons into node features for graph neural networks.

- Tags: how-to-guide
- Published: 2026-02-24

### [Message Passing Architecture in GcnSAGELayer: A Deep Dive into Doc2Graph's Graph Convolution](/andreagemelli/doc2graph/what-is-the-message-passing-architecture-in-gcnsagelayer)

Explore the message passing architecture in GcnSAGELayer. Doc2Graph merges GCN weighted aggregation and GraphSAGE concatenation for advanced graph convolutions. Learn more.

- Tags: deep-dive
- Published: 2026-02-24

### [How InputProjector Handles Multi-Modal Feature Fusion in Doc2Graph](/andreagemelli/doc2graph/how-does-inputprojector-handle-multi-modal-feature-fusion)

Learn how InputProjector achieves multi-modal feature fusion by projecting and concatenating diverse document slices into a unified vector for GNN processing.

- Tags: internals
- Published: 2026-02-24

### [NodeClassifier, EdgeClassifier, and E2E Models in doc2graph: Architecture Differences Explained](/andreagemelli/doc2graph/what-is-the-difference-between-nodeclassifier-edgeclassifier-and-e2e-models)

Discover the differences between NodeClassifier, EdgeClassifier, and E2E models in doc2graph. Learn how each architecture handles node and edge classification tasks for efficient graph analysis.

- Tags: 
- Published: 2026-02-24

### [How Doc2Graph Handles Class Imbalance with the balance_edges Method](/andreagemelli/doc2graph/how-does-doc2graph-handle-class-imbalance-with-the-balance_edges-method)

Doc2Graph uses the balance_edges method to tackle class imbalance by randomly downsampling dominant-class edges, promoting balanced training data.

- Tags: deep-dive
- Published: 2026-02-24

### [How the GraphBuilder Class Constructs DGL Graphs from FUNSD and PAU Datasets](/andreagemelli/doc2graph/how-does-the-graphbuilder-class-construct-dgl-graphs-from-funsdpau-datasets)

Learn how the GraphBuilder class constructs DGL graphs from FUNSD and PAU datasets by parsing layout data, extracting features, and building edges for advanced document analysis.

- Tags: how-to-guide
- Published: 2026-02-24

### [How to Run Inference on Custom Documents Using Pretrained Doc2Graph Weights](/andreagemelli/doc2graph/how-do-i-run-inference-on-custom-documents-using-pretrained-weights)

Run inference on custom documents with pretrained Doc2Graph weights. Follow clear instructions for using the inference function or CLI for efficient document analysis.

- Tags: how-to-guide
- Published: 2026-02-24

### [What Is the Role of Polar Coordinate Features in Edge Representation in doc2graph?](/andreagemelli/doc2graph/what-is-the-role-of-polar-coordinate-features-in-edge-representation)

Discover how polar coordinate features in doc2graph capture spatial layout using distance and angle to improve edge representation for graph neural networks.

- Tags: deep-dive
- Published: 2026-02-24

### [How Doc2Graph Performs Key-Value Pair Detection Using Edge Classification](/andreagemelli/doc2graph/how-does-doc2graph-perform-key-value-pair-detection-using-edge-classification)

Doc2Graph detects key-value pairs by framing extraction as binary edge classification, distinguishing key-value relationships from unrelated pairs.

- Tags: deep-dive
- Published: 2026-02-24

### [What Features Can Be Extracted and Added to Graph Nodes in doc2graph: geom, embs, hist, and visual](/andreagemelli/doc2graph/what-features-can-be-extracted-and-added-to-graph-nodes-geom-embs-hist-visual)

Discover how doc2graph extracts geom, embs, hist, and visual features to enrich graph nodes. Build powerful graph representations with FeatureBuilder.

- Tags: deep-dive
- Published: 2026-02-24

### [How the Doc2Graph E2E Model Architecture Works: End-to-End Entity and Relation Extraction](/andreagemelli/doc2graph/how-does-the-end-to-end-e2e-model-architecture-work-in-doc2graph)

Explore the Doc2Graph E2E model architecture, a unified graph neural network for simultaneous entity and relation extraction in a single forward pass. Understand its core implementation.

- Tags: architecture
- Published: 2026-02-24

### [How to Configure Node Granularity (gt, yolo, ocr) for Document Graphs in doc2graph](/andreagemelli/doc2graph/how-do-i-configure-node-granularity-gt-yolo-ocr-for-different-document-types)

Learn to configure node granularity gt yolo or ocr in doc2graph for document graphs. Control graph nodes based on ground truth YOLO or OCR data.

- Tags: how-to-guide
- Published: 2026-02-24

### [Fully Connected vs KNN Graph Topology in Doc2Graph: A Complete Guide](/andreagemelli/doc2graph/what-is-the-difference-between-fully-connected-and-knn-graph-topology-in-doc2graph)

Understand the difference between fully connected and KNN graph topology in Doc2Graph. Learn how to choose the right strategy for your document to graph conversions.

- Tags: deep-dive
- Published: 2026-02-24

### [How Doc2Graph Converts Document Images into Graph Representations](/andreagemelli/doc2graph/how-does-doc2graph-convert-document-images-into-graph-representations)

Learn how Doc2Graph converts document images into graph representations by extracting text, detecting bounding boxes, and building a feature-rich DGL graph for advanced analysis.

- Tags: how-to-guide
- Published: 2026-02-24

