Consensus algorithms are the core technology of blockchain and a focus in the current distributed system research. Although the practical Byzantine fault-tolerant (PBFT) algorithm has reduced communication time overhead, it still needs some processes such as node legitimacy checking, identity authentication, and primary node view change, and when reaching an agreement among nodes, time overhead will increase exponentially, rather than polynomial time. In response to the problem, a lightweight consensus algorithm based on graph (LCAG) is proposed for the Internet of Things (IoT) in this paper. The new algorithm proposes an access control table, reduces communication time overhead, quantifies a process for nodes to reach an agreement in distributed systems. The simulation results reveal that in the process for nodes to reach an agreement, the new algorithm needs less time overhead than the classical Byzantine algorithm need, as well as practical Byzantine fault-tolerant algorithm.