The paper introduces a novel dynamic graph representation algorithm called WiKG for histopathological whole slide image (WSI) analysis. WiKG addresses the limitations of existing methods by capturing interactions between instances and allowing flexible interactions at arbitrary locations. The approach constructs a dynamic graph where patches are nodes, and directed edges are formed based on the head and tail relationships between instances. A knowledge-aware attention mechanism updates the head node features by learning the joint attention score of each neighbor and edge, enhancing the representation of WSIs. Extensive experiments on three TCGA benchmark datasets and an in-house test set demonstrate that WiKG outperforms state-of-the-art methods in WSI classification tasks, particularly in tumor staging. The code for WiKG is available at <https://github.com/WonderLandsD/WiKG>.The paper introduces a novel dynamic graph representation algorithm called WiKG for histopathological whole slide image (WSI) analysis. WiKG addresses the limitations of existing methods by capturing interactions between instances and allowing flexible interactions at arbitrary locations. The approach constructs a dynamic graph where patches are nodes, and directed edges are formed based on the head and tail relationships between instances. A knowledge-aware attention mechanism updates the head node features by learning the joint attention score of each neighbor and edge, enhancing the representation of WSIs. Extensive experiments on three TCGA benchmark datasets and an in-house test set demonstrate that WiKG outperforms state-of-the-art methods in WSI classification tasks, particularly in tumor staging. The code for WiKG is available at <https://github.com/WonderLandsD/WiKG>.