US 12,072,938 B2
Graph generation method and apparatus, device, and storage medium
Yuan Xu, Beijing (CN); Ruifeng Ma, Beijing (CN); Xiaobo Huang, Beijing (CN); and Weifeng Huang, Beijing (CN)
Assigned to BEIJING ZITIAO NETWORK TECHNOLOGY CO., LTD., Beijing (CN)
Filed by Beijing Zitiao Network Technology Co., Ltd., Beijing (CN)
Filed on Nov. 29, 2022, as Appl. No. 18/071,395.
Claims priority of application No. 202210067041.7 (CN), filed on Jan. 20, 2022.
Prior Publication US 2023/0229705 A1, Jul. 20, 2023
Int. Cl. G06F 16/901 (2019.01); G06F 40/211 (2020.01)
CPC G06F 16/9027 (2019.01) [G06F 40/211 (2020.01)] 19 Claims
OG exemplary drawing
 
1. A graph generation method, applied to an electronic device comprising a processor, wherein the electronic device comprises a server or a terminal, wherein the method comprises:
parsing target logical information to obtain a plurality of logical elements;
converting the plurality of logical elements into a syntax tree according to logic of the target logical information, wherein the syntax tree comprises a plurality of layers of tree nodes, and tree nodes between layers have a dependency relationship;
converting the plurality of layers of tree nodes into a plurality of graph nodes; and
connecting the plurality of graph nodes according to the dependency relationship to obtain a logical graph corresponding to the target logical information to allow a user to perform special effect editing based on the logic;
wherein the target logical information comprises a mathematical formula; and
wherein converting the plurality of layers of tree nodes into the plurality of graph nodes comprises:
performing level traversal on the syntax tree;
in a case where a traversed tree node is an operator of the mathematical formula or a function of the mathematical formula, converting the traversed tree node into an operation graph node;
in a case where the traversed tree node is a numerical value of the mathematical formula, converting the traversed tree node into a numerical value graph node; and
in a case where the traversed tree node is a variable of the mathematical formula, converting the traversed tree node into a placeholder graph node.