CPC G06F 16/9027 (2019.01) [G06F 40/211 (2020.01)] | 19 Claims |
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.
|